Intro To Animation - Maya
Intro To Animation - Maya
Intro to Animation
for Science Communication
Jessica Kendall-Bar
Key words and concepts:
Last week’s AFTER EFFECTS WORKSHOP review Design:
• Animation
• Motion Graphics
51
50
# of people
40
30
20
10
8
2
0
None Some Intermediate
3D Animation workflow
https://youtu.be/qmuwXr3bNBY
Rigging
Creating a skeleton to constrain the motion of your 3D model.
RIGGING
Create joints and
bones so that your
3D model’s motion is
constrained.
RIGGING
Can create controls
for each joint to more
easily manipulate
joints.
Animation
Creating keyframes to define the position and rotation of each object (including controls within a skeleton rig) over time
Animation
Set keyframes to define
the position and rotation
of your character and
each of its joints.
Texture
Export UVs, paint and
create textures, and
then apply those to
your 3D model.
Texture
More complex example:
Tutorial
Linking CSV Motion Data to 3D Animation
Using sample dataset that can be found under Autodesk Maya Tutorial Resources at jessiekb.com/resources passcode ucsc
1. Download & store 3d model
Find a free 3D model online with an .obj download option.
Can’t decide on one? Download my free 3D seal here:
https://skfb.ly/6WSIz
Save in:
The script editor in Maya uses the default > scripts
coding language Python. Don’t be
afraid if you are not familiar- we will Your script goes here
go over the code step by step.
6. Understanding 3D data
Seconds pitch_deg roll_deg head_deg x_position z_position Depth (y_pos)
z
Typical
Accelerometer Axes
y
x
6. Understanding 3D data
Seconds pitch_deg roll_deg head_deg x_position z_position Depth (y_pos)
y
Default
Maya Axes
x
accel Maya y_position on Depth (vertical
Pitch = 0°
Roll = 0°
Heading = 0°
accel Maya y_position on Depth (vertical
Pitch = 45°
Roll = 0°
pitch
Heading = 0°
accel Maya y_position on Depth (vertical
Pitch = -45°
Roll = 0°
pitch
Heading = 0°
accel Maya y_position on Depth (vertical
Pitch = 0°
Roll = 0°
roll
pitch
Heading = 0°
accel Maya y_position on Depth (vertical
Pitch = 0°
Roll = 90°
roll
pitch
Heading = 0°
accel Maya y_position on Depth (vertical
Pitch = 0°
Roll = 180°
roll
pitch
Heading = 0°
accel Maya y_position on Depth (vertical
Pitch = 0°
Roll = 0°
roll
pitch
Heading = 0°
accel Maya y_position on Depth (vertical
heading
Pitch = 0°
Roll = 0°
roll
pitch
Heading = -45°
accel Maya y_position on Depth (vertical
0 0 0
10 Hz 0 -40 0 0 0 0 0
sampling rate 0.1 -40 0 0 0 1 -1
(10 samples
-40° 0° 0°
0.2 -40 0 0 meters left/right 0 2 -2
per second) 0.3 -40 0 0 0 3 -3
0.4 -40 0 0 0 4 -4
0.5 Pitching body -40 Rolling body 0 Pointing body 0 0 5 -5
0.6 40 degrees -40 0 degrees to 0 0 degrees to 0 0 6 -6
0 below horizon -40 either side 0 the right or left 0 0 0 0
0.1 -40 (not rolled 0 (12 o’clock 0 0 1 -1
0.2 -40 over) 0 position) 0 0 2 -2
… … … … … … …
46 -40
4.4 -6 0 0 0 44 -39.9
4.5 -4 0 0 0 45 -40
4.6 -2 0 0 0 meters forward 46 meters down -40
4.7 0 on belly 0 0 0 46 -40
4.8 0 (prone) 0 0 0 46 -40
4.9
5
5.1
0
0
0
0° 0
0
2
0
0
0
0
0
0
46
46
46
-40
-40
-40
5.2 0 4 0 0 46 -40
5.3 0 6 0 0 46 -40
… … … … … … …
13.7 0 174 0 0 46 -40
13.8 0 176 0 0 46 -40
13.9
14
14.1
0
0 180°
0 upside down
178
180
180
0
0
0
0
0
0
46
46
46
-40
-40
-40
(supine)
import csv
import pymel.core as pm
#Defining variables which will be used as column indices (can check these in ‘Sample Seal Data
This code is in Python. You can find this script (“Seal Sample
#Defining two variables which will be used as indices where animation starts and ends
START = 0 #start time in sec
END = 12 #end time in sec
Data Input Code.py”) in the Google Drive resources at fs = 10 #Sample frequency (in Hz or "samples per second")
#We will use the function float() to return floating point numbers (with decimals) for data values
Press CTRL + ENTER to run your code. pitch_value = -float(row[PITCH_DEG]) #add negative to fix orientation
head_value = float(row[HEAD_DEG])
roll_value = float(row[ROLL_DEG])
#Define which object will be transformed according to data (use name as described in "Outliner")
object = pm.ls('elephantseal')[0]
#..setKey function sets a keyframe of the given value at the given time.
object.translateX.setKey(value=translateX_value, time=time)
object.translateZ.setKey(value=translateZ_value, time=time)
object.translateY.setKey(value=depth_value, time=time)
object.rotateX.setKey(value=pitch_value, time=time)
object.rotateY.setKey(value=head_value, time=time)
object.rotateZ.setKey(value=roll_value, time=time)
print 'setting y= %s msw, x= %s, z= %s, rotX= %s, rotY= %s, rotZ = %s for time= %s frames' %
(depth_value , translateX_value , translateZ_value , pitch_value , head_value , roll_value , time)
Change to “Animation” workspace and then use ALT + V to toggle play/pause.
8. preview animation
Scrub forward and backward using the yellow playhead in the
Graph Editor (Windows>Animation Editors>Graph Editor)
The code will have added many (120 in our case) red
keyframes into the timeline, evenly spaced over 12 seconds
(286 frames).
9. smooth animation
If the motion from your data is too choppy, you can
reduce the number of keyframes by opening
“Simplify Curve” options by clicking on the small box
to the right of the option in the Curves menu.
10. PLAYBLAST
You can export a quick, low resolution preview of
your animation by going to Windows>Playblast
11. Scale your scene 12. Texture your seal
Make sure that the size of your character makes We don’t have a detailed texture to add here so we’ll
sense in relation to the size of the scene. In my just add a solid color. Right click and hold on the
case, I found that downscaling my elephant seal by elephant seal object, scroll down to “Assign Favorite
50% (Scale to 0.5 in 3 dimensions) makes it the Material”, and select the “Lambert” material.
right size compared to a max depth of 40 meters.
Rename
Recolor
13. Add some water
Create a plane and scale it up to 500 x 500 x 500
(don’t ask me why there is a y [vertical] dimension to a plane!)
17. Open up a render preview If you press the red play button
to preview the scene, you’ll see
that you get an error message,
saying there is no light in the
scene. So let’s add one!
2
1
Change “Repeat UV” values
to 10 from 1.
30. Loop displacement map textures
2
4 (right click)
3
1
File2.frameExtensions=((frame%120)+1);
31. Render your scene
Navigate to Rendering Menu Set and open Render Sequence settings.
1
2
4
Important! Otherwise
will only render 1
frame.