CS计算机代考程序代写 algorithm 3D Object Representation

3D Object Representation

1

Animation and Movie Making

2

Intended Learning Outcomes

 Distinguish two types of animation
 Describe the four steps of animation
 Describe key frame and intermediate frame generation

techniques
 Able to model and program common animation effects

such as acceleration, deceleration, and periodic motion

3

Two Types of Animation
 Real time animation

 Update parts of image in real time as soon as
available

 Frame by frame animation
 Use two frame buffers
 Display first buffer content
 Update on the second buffer
 Switch the two buffers when the new image has

finished drawing on the second buffer
 Use in system that does not require real time e.g.

movie production

4

Comparisons
 Real time animation
 Adv. Critical Information displayed as soon as

available
 Disadv. Refresh rate of each pixel must be at

least 16 frames/sec to avoid flickering
 Used in real time systems e.g. flight simulator,

multi-player games

 Frame by frame animation
 Adv. No flickering even if the refresh rate is low
 Disadv. Display of information may be delayed up

to one frame
 Used in non-real time systems e.g. movie

5

Designing an Animation
 Story Board

 outline of the action. Defines the motion sequence as a
set of basic events that are to take place

 Object Definitions
 choose the object representation and movement of each

object in the story
 Generation of Key Frames

 generate a detailed image of the scene at a certain time in
the animation sequence

 More key frames are specified when the motion is
intricate

 Generation of In-between Frames
 Intermediate frames between the key frames.
 The number of in-betweens needed is determined by the

media to be used to display the animation.

6

Key frames

From comic “H2”

7

Generation of in-between frames from
key frames
 Key frames can be generated by the CG pipeline
 Morphing can be used to generate in-between frames
 Morphing – short form for metamorphosis
 It is a transformation of object shape from one form to

another

8

Morphing

 Step 1 : Equalize the number of vertices of the two
shapes

 Step 2 : Find correspondence between each pair of
vertices

 Step 3 : Find intermediate positions of the vertices by
interpolation

9

Algorithm
Input : Key frames k and k+1

Algorithm

1. Let Vk be the number of vertices in key frame k. Compute

),max( 1max += kk VVV ),min( 1min += kk VVV

and

)1mod()1( minmax −−= VVNls

)
1
1

int(
min

max


=
V
V

N p // int (x) takes the largest integer smaller than x

2. Add Np points to Nls line sections of keyframemin (the key frame with less number of

vertices)

Add Np – 1 points to the remaining edges of keyframemin

// now both key frames have equal number of vertices

3. Linearly interpolate for each pair of corresponding vertices in the two key frames to

generate the in-between frames

Output: a set of in-between frames

10

11

12

Simulating Acceleration and
Deceleration

 Idea : Adjust the time spacing of successive frames
 n in-between frames for two key frames at t = t1 and t2
 Constant velocity

n …, 2, 1, j
1 121

ttt
n

tj
ttB j −=∆=+


+=

13

Empirical functions
 Acceleration: Use empirical function 1- cos θ 0< θ < π/2  Deceleration: Use sin θ  Accelerate then decelerate: Use ] )1(2 cos1[1 + −∆+= n j tttBj π ] )1(2 [sin1 + ∆+= n j tttBj π πθθ <<− 0)cos1( 2 1 14 Acceleration 15 Deceleration 16 Acceleration then Deceleration 17 Specifying Motion (1)  For general motions, empirical functions are not accurate enough  Three ways to calculate motion  Direct Motion specification  Solve the motion equations, then just plot the trajectory  Example: simple harmonic motion  Kinematics and dynamics  Kinematics : calculate position, velocity and acceleration 2 0 2 1 atutssatuv ++=+= 18 Simple harmonic motion 19 Specifying Motion (2)  Inverse Kinematics Specify the initial and final conditions, then the system solves for the motion  Dynamics Specify the forces : Physically based modelling  Inverse Dynamics  Goal Directed System  Specify desired behaviour : “Walk”, “Run”  Converted into mathematical motion by the system maxxhkvF =−−− )( 0 20 Periodic Motion  Motion must be synchronized with the frame rate, otherwise may result in incorrect motion  A typical example is shown in the figures below.  Solutions  Generate a frame after each fixed angle increment, but this may cause other problems if the periodic motion is too fast  Use timer and ask user to have a certain minimum graphics capability in their computer (common practice in games)  Periodically reset parameters to prevent numerical error build up 21 22 23 OpenGL Commands  Double Buffering  glutInitDisplayMode (GLUT_DOUBLE)  glutSwapBuffers ( );  To produce an animation  glutIdleFunc (animationFcn)  animationFcn is a procedure written by the user to update the animation parameters  glutPostRedisplay ( );  See example program in pg. 410  Using the timer  glutGet( GLUT_ELAPSED_TIME ) 24 References  Text: Ch. 12 Animation and Movie Making Intended Learning Outcomes Two Types of Animation Comparisons� Designing an Animation Key frames Generation of in-between frames from key frames Morphing Algorithm Slide Number 10 Slide Number 11 Simulating Acceleration and Deceleration Empirical functions Slide Number 14 Slide Number 15 Slide Number 16 Specifying Motion (1) Slide Number 18 Specifying Motion (2) Periodic Motion Slide Number 21 Slide Number 22 OpenGL Commands References ) , max( 1 max + = k k V V V ) , min( 1 min + = k k V V V ) 1 mod( ) 1 ( min max - - = V V N ls ) 1 1 int( min max - - = V V N p Input : Key frames k and k+1 Algorithm 1. Let Vk be the number of vertices in key frame k. Compute and // int (x) takes the largest integer smaller than x 2. Add Np points to Nls line sections of keyframemin (the key frame with less number of vertices) Add Np - 1 points to the remaining edges of keyframemin // now both key frames have equal number of vertices 3. Linearly interpolate for each pair of corresponding vertices in the two key frames to generate the in-between frames Output: a set of in-between frames _1160814094.unknown _1160814102.unknown _1322636107.unknown _1160814091.unknown