540 likes | 682 Views
Computer Animation. Computer Graphics Basics. Terms. Raster - set of horizontal scan lines on a display Scan line - row of individual pixels Pixel - picture element; smallest directly addressable element in a raster Scan Conversion - determining which pixels to set, and with what values.
E N D
Computer Animation Computer GraphicsBasics
Terms • Raster - set of horizontal scan lines on a display • Scan line - row of individual pixels • Pixel - picture element; smallest directly addressable element in a raster • Scan Conversion - determining which pixels to set, and with what values
Scale Rotate Translate 3-D 3-D Scale Rotate 3-D Object Space World Space Eye Space Projection Change coordinate system 2-D 2-D Screen Space Normalized Eye Space Viewing pipeline
Coordinate systems • Object/World/Eye • real coordinates • infinite in all directions • Normalized • real coordinates • world and screen independent • Screen • integer coordinates • finite in all directions
Vectors • A point is most oftened represented by a coordinate tuple • In 2D graphics that would be (x, y)
Vectors • This tuple can either be interpreted as an actual point P, or … • As a vector that when applied to a coordinate system’s origin O, takes you to the point P = (x, y) O
Vectors • Vectors can be transformed to allow for - Scaling - Rotation - Translation - Shearing - Etc. P = (x, y) O
Vectors • Vectors can also be represented by a single column matrix P = (x, y) O
Scaling Sx = 2, Sy = 1 P’ = (Sxx, Sy y) • x and y are mulitplied by scalar values Sx and Sy, respectively • This allows for the magnitude in each dimension to be changed independently P = (x, y) O
Scaling • Scaling can also be accomplished via matrix muliplication O
Rotation • Rotation is moving a point P about an origin O • That is, changing the direction of the vector but not it’s magnitude O
Rotation • The equations for rotation are ... O
Rotation • Using matrices ... O
Translation • Offsetting (moving) a point from one place to another • Tx and Ty are added to x and y, respectively • x’ = Tx + xy’ = Ty + y O
Translation • In order to use matrix multiplication, • We need to extend our point vector to create homogeneous coordinates O
Polygons • All vertices (points) are represented by vectors • All vertices have the same transformations applied to them
Preferred order • If we rotate before scaling, … • Our shapes lose their integrity O • So, we scale first, then rotate
Preferred order • If we translate before rotating, … • Our shapes are not placed correctly O • Why? Because you end up rotating the translation vector as well!
3-D coordinates • Normal (x,y,z) • Homogeneous (x,y,z,h)
3-D World Coordinate Systems • Same as for 2-D, with the addition of a z-axis • Two orientations are generally used • Right-handed • Left-handed • For each, the thumb points in the +x direction, the pointer finger is +y, and the middle finger is +z
+Y +Y +Z +X +X +Z 3-D World Coordinate Systems Right-handed Left-handed
Projections • Perspective • One-point • Two-point • Three-point • Parallel • Orthographic • Top (plan) • Front elevation • Side elevation • Axonometric • Isometric
Orthographic projection • Side • Front • Top • Normals and projections in same direction • Side, front and top views
Orthographic projection • Axonometric • Projection planes are not normal to principal axis • Show several faces at once • Isometric • Projection-plane normal makes equal angles with each principal axis
Perspective projection y z-axis vanishing point x z
Viewing Volume view reference point • Starting with a projection reference point (PRP) we trace four lines, one through each corner of the window • The window in located on the view plane • The resulting pyramid is called a view volume projection reference point
Projecting an image • The first step in rendering 3-D images, is to project the object onto the 2-D view plane
Projecting an image • The distance from the PRP to the view plane is called the viewing distance z yp y viewingdistance (d)
Projecting an image • The position of a point, as projected on the view plane, is computed by ...
Projecting an image • Using matrices … • We create an intermediate vector • Dividing this vector by z /d yields our projected point
Frustum View Volume • The viewing volume is turned into a frustum by adding front and back planes • Only objects within the frustum are visible back view plane front prp
Parallelpiped View Volume • Adjacent sides are at right angles to each other • A frustum to parallelpiped transformation is accomplished via scaling or shearing and scaling prp front vp back
Parallelpiped View Volume • Simple case: only scaling • Caution!Division by zero up ahead! • Go review earlier discussion yp y z d
Generalized Transformation • Q : What happens when the viewing vector is not perpendicular to the viewplane? • A : First Shear and then Scale!
First, Shear vp
First, Shear vp
Then, Scale vp
Then, Scale vp
Modeling Coordinates World Coordinates Eye Coordinates Projection Coordinates Normalized Coordinates Screen Coordinates Viewing Pipeline Question?What operations move us from one system to the next?
Curves • Parametric • Hermite • Bezier • B-spline
Parametric Representation Pn • For a given curve, each point Pk=(xk, yk, zk) can be represented by a set of parametric equations • For cubic interpolations, these take the form of:x(u) = axu3 + bxu2 + cxu + dxy(u) = ayu3 + byu2 + cyu + dyz(u) = azu3 + bzu2 + czu + dz P0 Pk
Hermite Interpolation • A curve segment is defined by two, consecutive points on a curve • P(0) = pkP(1) = pk+1P´(0) = pkP´(1) = pk+1
Hermite Interpolation • The polynomials that result from expanding the equation …[u3 u2 u 1]MH GH= Hk(u)are termed blending functions
Bézier CurvesProperties • Always passes through first and last control points p1 p´2 p2 p´0 p0 p´1 • Displays C1 continuity where segments join (same slope)
Bézier Curves • Based on a series of blending functions, BEZk,n(u) = C(n,k)uk(1-u)n-k • Where ... • Such that ... • This is for n+1 control points