1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Lecture computer graphics and virtual reality slides lesson 6 viewing transformation

35 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Viewing Transformation
Tác giả Trinh Thanh Trung
Trường học School of ICT, HUST
Định dạng
Số trang 35
Dung lượng 1,09 MB

Nội dung

Trang 4 Viewing transformation■ More logical to use dimensions which are appropriate to the object.. □metres for buildings, □millimetres for assembly parts, □nanometres or microns for mo

Trang 1

Lesson 6

Viewing Transformation

Trinh Thanh Trung School of ICT, HUST

Trang 2

Content

Trang 3

Overview

Trang 4

Viewing transformation

appropriate to the object e.g

□ metres for buildings,

□ millimetres for assembly parts,

□ nanometres or microns for molecules, cells, and

atoms

physical size in the real world,

screen co-ordinates before displaying

Trang 5

Viewing transformation

co-ordinates to Screen Coco-ordinates

view

effect without changing the model by scaling

dimensions proportionally

Trang 6

screen co-ordinates?

Trang 7

Viewing transformation

view volume

Trang 8

Homogeneous Coordinates

the same point when all elements are multiplied by the same factor

□ (2,0,1,1) and (4,0,2,2) are the same points

□ To bring back to Cartesian space, need to

divide the other elements by the fourth element w

(x, y, z, w) → (x/w, y/w, z/w, 1)

Trang 9

2D viewing transformation

Trang 10

Window and viewport

Window: the portion of the world which will be

displayed

Viewport: The screen where the image will be

displayed

(wx min ,wy min)

(wx max ,wy max)

(vx min ,vy min)

(vx max ,vy max)

Trang 11

Transformation

Trang 12

0 0 1

1

Yw Xw

0

0 min max

min max

0

0 0

Xwmin -

Xwmax

Xvmin -

Xvmax

] 1 [

Yw Yw

Yv Yv

0 0 1 ]

2 [

Yy Xv T

Trang 13

Combined transformation matrix

min

max min

min Xwmin

Xwmax

-Xvmin -

Xvmax min

min

0 min

max

min

max 0

0 0

Xwmin -

Xwmax

Xvmin -

Xvmax

]

[

] 2 [ ] 1 [ ]

Yv

Yv Yw

Yv Xw

Xv

Yw Yw

Yv

Yv T

T x S x

T

T

Trang 14

Example in OpenGL

//set the viewing coordinates

setWindow(xmin, xmax, ymin, ymax);

-void setWindow(GLdouble left, Gldouble right, GLdouble bottom, GLdouble top) {

-void setViewport(GLdouble left, Gldouble right, GLdouble bottom, GLdouble top)

{ glViewport(left, bottom, right – left, top - bottom);

}

Trang 15

3D viewing transformation

Trang 16

3D viewing

■ Part of the difficulty lies in trying to display three dimensional objects on a 2D display

lead to different 2D representations at the

projection stage

□ The projected 2D image of a 3D object is viewer

dependent

parameters e.g position, orientation, field of view

Trang 17

3D viewing

□ a description of the scene geometry

□ a view definition (camera)

plane

in 2D viewing

scene geometry onto a 2D surface for display

Trang 20

Camera analogy

components, specified independently:

objects (a.k.a geometry)

viewer (a.k.a camera)

projection plane (usually in front of the camera).

Projectors emanate from the center of

projection (COP) at the center of the lens (or

pinhole)

The image of an object point P is at the intersection

of the projector through P and the image plane.

Trang 21

Camera analogy

four kinds of parameters:

Position: the COP.

Orientation: rotations about axes with origin at the COP.

Focal length: determines the size of the image on the film plane, or the

field of view.

Film plane: its width and height.

Trang 22

transformation

Trang 23

Camera parameters

■ View Reference Point (VRP): origin of our viewing system (position of the camera)

■ View Plane Normal vector (VPN): viewing direction

■ View UP vector (VUP): establishes orientation of

“camera”

),,(n1 n2 n3

=

=

N

N n

),,(u1 u2 u3

N V u

) , , ( v1 v2 v3

=

= n u v

Trang 24

Viewing transformation

■ (xw, yw, zw) and (u, v, n) are 2 coordinate systems with the same centre

M WC,VC = R T

24

,

,

3 2 1

3 2 1

3 2

v v v

u u

u

n v

u

Trang 25

100

010

001

0 0 0

z y

0

000

3 2

1

3 2

1

3 2

1

n n

n

v v

v

u u

u

R

T R

Trang 26

Viewing transformation

following transformation sequence:

□ Translate the view reference point to the origin of the world co-ordinate system

□ Apply Rotations to align xv, yv and zv, axes, respectively

1 0 0

0 1 0

0 0 1

0 0 0

z y x

Trang 27

Viewing transformation

27

1 0 0 0

0 0

0

3 2 1

3 2 1

3 2 1

v v v

u u u

u u

u

R u

Trang 28

Camera movement

□ The camera is positioned using a combination of translations and rotations.

□ Think if the camera being in the same location as the viewers eye.

and position

own axes

28

Trang 29

Camera in OpenGL

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

gluLookAt(eye.x, eye.y, eye.z,

look.x, look.y, look.z, up.x, up.y, up.z);

29

Trang 30

Camera Movement

1 slid in 3 directions; and

2 rotated in 3 directions

□ The camera can move along its axes.

This is called sliding the camera.

30

Trang 31

■ Besides physically moving the camera to another location, the camera can be tilted in different directions to look at different parts of the scene.

31

u v

n

Trang 32

The Camera - Camera Movement

■ We use a plane analogy to describe the cameras movement.

□ a rotation from the horizontal along the length is called PITCH

□ a rotation from the horizontal along the width is called ROLL

□ a rotation around the vertical is called YAW

32

Trang 33

u v

u n

Trang 34

Any questions?

Trang 35

Lecture notes provided by School of Information and

Communication Technology, Hanoi University of Science and

Technology.

Composed by Huynh Quyet Thang, Le Tan Hung, Trinh Thanh

Trung and others

Edited by Trinh Thanh Trung

Special thanks to all the people who made and released these awesome resources for free:

■ Presentation template by SlidesCarnival

■ Photographs by Death to the Stock Photo ( license )

■ Diverse device hand photos by Facebook Design Resources

Ngày đăng: 02/03/2024, 13:59

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN