Viewing CS418 Computer Graphics John C. Hart Graphics Pipeline - - PowerPoint PPT Presentation

viewing
SMART_READER_LITE
LIVE PREVIEW

Viewing CS418 Computer Graphics John C. Hart Graphics Pipeline - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Viewing

CS418 Computer Graphics John C. Hart

slide-2
SLIDE 2

Graphics Pipeline

Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords. Clipping Window Coordinates Window to Viewport Viewport Coordinates Clip Coords. Viewing Coords Perspective Distortion

slide-3
SLIDE 3

Graphics Pipeline

Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords. Clipping Window Coordinates Window to Viewport Viewport Coordinates Clip Coords. Viewing Coords Perspective Distortion

W2V Persp View Model 1 1

s m s m m

x x y y z                                                                         

slide-4
SLIDE 4

Graphics Pipeline

Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords. Clipping Window Coordinates Window to Viewport Viewport Coordinates Clip Coords. Viewing Coords Perspective Distortion

1

s s

x y                    1

m m m

x y z                  

M

slide-5
SLIDE 5

Transformation Order

1

s s

x y                    1

m m m

x y z                  

M

x y z glutSolidTeapot(1); glRotate3f(-90, 0,0,1); glTranslate3f(0,1,0); glutSolidTeapot(1); glTranslate3f(0,1,0); glRotate3f(-90, 0,0,1); glutSolidTeapot(1);

1

s s

x y                    1

m m m

x y z                                          

M R T

1

s s

x y                    1

m m m

x y z                                          

M T R

slide-6
SLIDE 6

Viewing Transformation

Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords. Clipping Window Coordinates Window to Viewport Viewport Coordinates Clip Coords. Viewing Coords Perspective Distortion

W2V Persp View Model 1 1

s m s m m

x x y y z                                                                         

slide-7
SLIDE 7

Viewing Transformation

W2V           Model           View           Persp          

Model Coords World Coords Viewing Coords Clip Coords Screen Coords x y z x y lookat point eye point

slide-8
SLIDE 8

x y z

World Coordinates Viewing Coordinates

x y z

eye point lookat point eye point (at origin) lookat point (along –z axis)

slide-9
SLIDE 9

x y z

World Coordinates Viewing Coordinates

x y

eye point lookat point lookat point (along –z axis)

slide-10
SLIDE 10

x y z

World Coordinates Viewing Coordinates

x y

eye point lookat point

y' x' Why not these axes?

slide-11
SLIDE 11

x y z

World Coordinates Viewing Coordinates

y z

eye point lookat point up vector up vector up

  • 1. Specify up direction in

world coordinates

  • 2. Transform up vector into

viewing coordinates

  • 3. Rotate about z-axis until

up vector in x-y plane.

x

slide-12
SLIDE 12
slide-13
SLIDE 13

Lookat Transformation

x y z lookat point eye point up vector

slide-14
SLIDE 14

Lookat Transformation

  • 1. Translate the eye point

to the origin

x y z

1 1 1 1 x y z               

slide-15
SLIDE 15

Lookat Transformation

  • 1. Translate the eye point

to the origin

  • 2. Rotate the view vector

into the negative z-axis

x y z

1 1 1 1 x y R z                           

x y z

slide-16
SLIDE 16

Easier Way

  • Orthogonalize lookat vector system

x y z up v

slide-17
SLIDE 17

Easier Way

  • Orthogonalize lookat vector system

– Let r = v  up/||vup|| x y z up r v

slide-18
SLIDE 18

Easier Way

  • Orthogonalize lookat vector system

– Let r = v  up/||vup|| – Let u = r  v x y z up u v r

slide-19
SLIDE 19

Easier Way

  • Orthogonalize lookat vector system

– Let r = v  up/||vup|| – Let u = r  v – Create rotation matrix from <r,u,-v> to <x.y,z> R r = x, R u = y, R v = -z x y z up u v r

slide-20
SLIDE 20

Construct Lookat

  • Translate eye point to origin
  • Rotate view into -z axis

– Let v = (lookat - eye)/||lookat - eye|| – Let r = v  up/||vup|| – Let u = r  v x y z

x y z

lookat point eye point up vector

slide-21
SLIDE 21

Viewing Transformation

W2V           Model           View           Persp          

Model Coords World Coords Viewing Coords Clip Coords Screen Coords x y z x y z lookat point eye point