2009
Table Of Contents
- Contents
- Overview
- Maya Basics
- Polygonal Modeling
- Introduction
- Preparing for the lesson
- Lesson 1: Modeling a polygonal mesh
- Introduction
- Setting modeling preferences
- Using 2D reference images
- Creating a polygon primitive
- Modeling in shaded mode
- Model symmetry
- Selecting components by painting
- Selecting edge loops
- Editing components in the orthographic views
- Editing components in the perspective view
- Drawing a polygon
- Extruding polygon components
- Bridging between edges
- Adding polygons to a mesh
- Splitting polygon faces
- Terminating edge loops
- Deleting construction history
- Mirror copying a mesh
- Working with a smoothed mesh
- Creasing and hardening edges on a mesh
- Beyond the lesson
- NURBS Modeling
- Subdivision Surfaces
- Animation
- Introduction
- Preparing for the lessons
- Lesson 1: Keyframes and the Graph Editor
- Lesson 2: Set Driven Key
- Lesson 3: Path animation
- Lesson 4: Nonlinear animation with Trax
- Introduction
- Open the first scene for the lesson
- Creating clips with Trax
- Changing the position of clips with Trax
- Editing the animation of clips
- Reusing clips within Trax
- Soloing and muting tracks
- Scaling clips within Trax
- Open the second scene for the lesson
- Creating clips from motion capture data
- Extending the length of motion capture data
- Redirecting the motion within a clip
- Beyond the lesson
- Lesson 5: Inverse kinematics
- Introduction
- Open the scene for the lesson
- Understanding hierarchies
- Viewing hierarchies using the Hypergraph
- Creating a skeleton hierarchy
- Parenting a model into a skeleton hierarchy
- Applying IK to a skeleton hierarchy
- Creating a control object for an IK system
- Constraining an IK system
- Limiting the range of motion of an IK system
- Simplifying the display of a hierarchy
- Applying parent constraints on an IK system
- Planning an animation for an IK system
- Animating an IK system
- Beyond the lesson
- Character Setup
- Polygon Texturing
- Rendering
- Introduction
- Preparing for the lessons
- Lesson 1: Rendering a scene
- Introduction
- Open the scene for the lesson
- Creating shading materials for objects
- Refining shading materials for objects
- Maya renderers
- Rendering a single frame using IPR
- Rendering using the Maya software renderer
- Batch rendering a sequence of animation frames
- Viewing a sequence of rendered frames
- Beyond the lesson
- Lesson 2: Shading surfaces
- Lesson 3: Lights, shadows, and cameras
- Lesson 4: Global Illumination
- Lesson 5: Caustics
- Dynamics
- Painting
- Introduction
- Preparing for the lessons
- Lesson 1: Painting in 2D using Paint Effects
- Lesson 2: Painting in 3D using Paint Effects
- Introduction
- Preparing for the lessons
- Brushes and strokes
- Rendering Paint Effects strokes
- Paint Effects on 3D objects
- Creating a surface to paint on
- Painting on objects
- Using turbulence with brush stroke tubes
- Using additional preset brushes
- Mesh brushes
- Converting mesh strokes to polygons
- Modifying a converted polygonal mesh
- Beyond the lesson
- Lesson 3: Painting textures on surfaces
- Expressions
- Scripting in Maya
- Index
convert from degrees to radians when using the sine function to calculate the
Y offset.
NOTE Radians are a method of measuring sections of a circle. There are 360
degrees in a circle, which is equivalent to 2pi radians.
To calculate the offset in Y
1 Declare a new variable to store the value of the Y offset by typing the
following:
float $Y_offset;
2 Calculate the value of the Y-offset using the sine ratio. You must convert
the value of the angle to degrees with the degree to radian conversion
function.
$Y_offset = $diameter_barrel * (sin(deg_to_rad(60)));
The assignment operator evaluates the right hand side of the expression
and assigns it to the left hand side. The degree to radian conversion
function is the first to be evaluated, as it is within the most interior set
of brackets. The sine function calculates the sine of the angle given in
radians. The sine value is multiplied by the diameter to calculate the Y
offset. The variable is assigned the calculated value.
NOTE The variable $diameter_barrel does not change in value. Only the
variable on the left side of an assignment operator changes in value.
To stack the rows of barrels
1 Select and duplicate all the objects in the scene, by typing the following:
select -allDagObjects;
duplicate;
Using the select command with the -allDagObjects flag selects all DAG
(Directed Acyclic Graph) objects, which are a set of objects that exist in
the scene such as geometry, IK chains and measure tools. Textures and
animation information do not belong to the Directed Acyclic Graph.
2 Offset the barrels by the radius of a barrel in X and the calculated
$Y_offset in Y, divide the diameter by 2 to get the value of the radius.
When duplicating the rows, you have created too many barrels.
move -r 0 $Y_offset ($diameter_barrel/2.0);
duplicate;
move -r 0 $Y_offset ($diameter_barrel/2.0);
620 | Chapter 13 Scripting in Maya