Computer Graphics: Lecture 10 - Computer Animation and Viewing Transformation
Computer Graphics: Lecture 10 - Computer Animation and Viewing Transformation
GRAPHICS
LECTURE 10_ COMPUTER ANIMATION AND VIEWING TRANSFORMATION
COMPUTER ANIMATION
Generation of In-
Between Frames
STORYBOARD LAYOUT
• Storyboard is an outline of
actions. It defines the motion
sequence as a set of basic
events that are to take place.
• Storyboard could consist of
rough sketches along with
descriptions of the motions
OBJECT DEFINITION
In hand-drawn animation,
a keyframe is a specific
frame within the animated
movement that the
animator uses as a guide
to building the rest of his
work around.
Computer Graphics by Hearn & Baker
TRADITIONAL Squash and Stretch
ANIMATION
TECHNIQUES Timing
Anticipation
Staging
ANIMATION SYSTEMS
Parameterized systems
Scripting systems
KEY FRAME SYSTEMS
Viewing transformation
Modeling transformation
Projection transformation
Viewport transformation
1)Orthographic Projection(glOrtho)
Functions
glOrtho2D(left,right,bottom,top)
gluOrtho(left,right,bottom,top,near,far)
2)Perspective Projection
Functions
glFrustum(left,right,bottom,top,near,far)
gluPerspective(fovy,aspect,near,far)
Orthographic projection
top
z left
right
Bottom
It is the same as the glOrtho(), except zNear = -1.0, and zFar = 1.0
Perspective projection
1)glFrustum( left, right, bottom, top, zNear, zFar )
Creates a matrix for a perspective viewing frustum
and multiplies the current matrix by it.
top left
right
bottom
Near-plane: zNear
Specify the points on the near clipping
plane that are mapped to the lower left Viewing volume
and upper right corners of the window,
respectively, assuming that the eye is
located at (0, 0, 0).
GLUPERSPECTIVE( FOVY, ASPECT, ZNEAR, ZFAR)
y
aspect ratio = w /h
w h
z
fovy
x N ear-plane: zN ear Far-plane: zN ear
The fovy parameter stands for the “field of view y-axis” and is the
vertical angle of the camera’s lens. Common values for fovy range
from 30 to 60 degrees. The aspect ratio parameter is the width
divided by the height of the canvas window.
DEMO TO
UNDERSTAND THE
PERSPECTIVE
PROJECTION
PARAMETERS
HTTP://LEARNWEBGL.BRO
WN37.NET/08_PROJECTION
S/CREATE_PERSPECTIVE/C
REATE_PERSPECTIVE.HTML
3D GRAPHICS PIPELINE REVIEW
WORLD SCENE/OBJECT
Modelling coordinates:
- world coordinate system, MODELLING
- object coordinate system
VIEWING
CLIPPING
Camera coordinates
PROJECTION
Screen coordinates
RASTERIZATION
Device coordinates
PIXEL DISPLAY
3D VIEWING
• Inherently more complex than 2D process
• Part of the difficulty lies in trying to display three dimensional
objects on a 2D display
• Different views on the same object eventually lead to different 2D
representations at the projection stage
• the projected 2D image of a 3D object is viewer dependent
DIFFERENT VIEWS
Viewing a 3D world
Camera
Camera Model
Orientation
Up Vector Camera
Direction
Camera
Position
CAMERA VIEWING
gluLookAt (eyex, eyey, eyez, atx, aty, atz, upx, upy, upz )
gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center
of the scene, and an UP vector.
Where I am and Looking at
View-up vector
Loot at y
(upx, upy, upz)
y
(atx, aty, atz)
x x
Model
z z
Eyepoint
(eyex, eyey, eyez)
SETTING THE OPENGL CAMERA
void gluLookAt( GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ,
GLdouble centerX, GLdouble centerY, GLdouble centerZ,
GLdouble upX, GLdouble upY, GLdouble upZ);
Camera position
(0,0,2)
(x, y, z)=(0,-1,0)
-z
-x +x
+z
If you want to move in upward
and downward direction then y
axis is included
CAMERA MOVEMENT IN X-Z DIRECTION