Viewing CS418 Computer Graphics John C. Hart
Graphics Pipeline Model Model World Viewing Viewing Perspective Coords Xform Coords Xform Coords Distortion Still Homogeneous Clip Clip Clipping Divide Coords. Coords. Window Window Viewport to Coordinates Coordinates Viewport
Graphics Pipeline Model Model World Viewing Viewing Perspective Coords Xform Coords Xform Coords Distortion Still Homogeneous Clip Clip Clipping Divide Coords. Coords. Window Window Viewport to Coordinates Coordinates Viewport x x s m y y s m W2V Persp View Model 0 z m 1 1
Graphics Pipeline Model Model World Viewing Viewing Perspective Coords Xform Coords Xform Coords Distortion Still Homogeneous Clip Clip Clipping Divide Coords. Coords. Window Window Viewport to Coordinates Coordinates Viewport x x s m M y y s m 0 z m 1 1
Transformation Order glutSolidTeapot(1); glRotate3f(-90, 0,0,1); glTranslate3f(0,1,0); glTranslate3f(0,1,0); glRotate3f(-90, 0,0,1); glutSolidTeapot(1); glutSolidTeapot(1); y x z x x x x x x s m s m s m M M R T M T R y y y y y y s m s m s m 0 0 0 z z z m m m 1 1 1 1 1 1
Viewing Transformation Model Model World Viewing Viewing Perspective Coords Xform Coords Xform Coords Distortion Still Homogeneous Clip Clip Clipping Divide Coords. Coords. Window Window Viewport to Coordinates Coordinates Viewport x x s m y y s m W2V Persp View Model 0 z m 1 1
Viewing Transformation eye point lookat y point y x x z Screen Clip Viewing World Model Persp View Model W2V Coords Coords Coords Coords Coords
Viewing World Coordinates Coordinates y lookat point eye point eye point lookat point (along – z axis) (at origin) z y x x z
Viewing World Coordinates Coordinates y lookat point eye point lookat point (along – z axis) y x x z
Viewing World Coordinates Coordinates y lookat point eye point Why not y' these axes? x' y x x z
Viewing World Coordinates Coordinates 1. Specify up direction in world coordinates up y 2. Transform up vector into viewing coordinates lookat point eye point 3. Rotate about z-axis until up vector in x-y plane. z y x x z up vector up vector
Lookat Transformation up eye vector point lookat point y x z
Lookat Transformation 1. Translate the eye point to the origin 1 x y 1 y x 1 z z 1
y Lookat Transformation z 1. Translate the eye point to the origin x 2. Rotate the view vector into the negative z-axis 1 x y 1 y R x 1 z z 1
Easier Way y • Orthogonalize lookat vector system up v x z
Easier Way y • Orthogonalize lookat vector system up – Let r = v up /|| v up || v x r z
Easier Way y • Orthogonalize lookat vector system up u – Let r = v up /|| v up || v – Let u = r v x r z
Easier Way y • Orthogonalize lookat vector system up u – Let r = v up /|| v up || v – Let u = r v – Create rotation matrix from x < r , u ,- v > to < x . y , z > r z R r = x , R u = y , R v = - z
eye Construct Lookat point lookat up point vector • Translate eye point to origin y • Rotate view into -z axis x z – Let v = (lookat - eye)/||lookat - eye|| – Let r = v up /|| v up || – Let u = r v y z x
Viewing Transformation eye point y lookat point x y z x z Screen Clip Viewing World Model Persp View Model W2V Coords Coords Coords Coords Coords
Recommend
More recommend