1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review...

35
1 Projection

Transcript of 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review...

Page 1: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

1

Projection

Page 2: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

2

Model Transform

Viewing Transform

ModelviewMatrix

worldcoordinates

Pipeline Review

Focus of this lecture

Page 3: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

3

Review (Lines in R2)

2121

2121

,

0 0

:lines twoofon intersecti asPoint

0 0

:line a determine points Two

0

equation line sHomogeneou

),,(),,,(

00

llplpandlp

ppllpandlp

lp

wvupcbal

cwbvaucbyax wv

wu yx

Page 4: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

4Parallel Projection

Projection (R2)

viewpoint

viewline

bacabcbac

bacabccba

bacabcbac

bacabccba

Page 5: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

5

Perspective Projection

~

~

Page 6: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

6

Parallel Projection

~

~

Page 7: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

7

Projection (R3)

See handout for proof!

Page 8: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

8

ExampleVertices (0,0,0), (2,0,0), (2,3,0), (0,3,0) (1,1,1), (1,2,1)

Parallel projection: onto z = 0 planev = (0,0,1,0)T, n = (0,0,1,0)T

Page 9: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

9

Vertices (0,0,0), (2,0,0), (2,3,0), (0,3,0) (1,1,1), (1,2,1)

Perspective projection: onto z = 0 plane from viewpoint (1,5,3)v = (1,5,3,1)T, n = (0,0,1,0)T

Page 10: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

10

321

321

321

,,ˆ

,,ˆ

,,

ssss

rrrr

qqqO

p’ p” O

Viewplane Coordinate Mapping

Page 11: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

11

Determine Viewplane Transform by Homogeneous Transformation

144313 pVp133414 pKp

001

100

010

001333

222

111

srq

srq

srq

K4×3

Page 12: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

12

144313 pVp133414 pKp

pIpKp LL

L: left inverse of K

Page 13: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

13

ExampleViewplane origin (1,2,0) u-axis (3,4,0) v-axis (-4,3,0)

Page 14: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

14

Orthographic Projection

• Def: direction of projection viewplane

0,,, :viewpoint

,,, : vectorviewplane

321

4321

nnnv

nnnnn

v

n

… is a parallel projection

)(000

)(

)(

)(

23

22

21

4322

213231

423223

2121

41312123

22

nnn

nnnnnnnn

nnnnnnnn

nnnnnnnn

Page 15: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

15

Definitions• Direction cosine (ref)

• Foreshortening ratio= (length of projected segment)/(length of original segment)

1

cos,cos,cos

222

nml

A

An

A

Am

A

Al zyx

Page 16: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

16

Theorem

• If the direction cosines of the plane normal (in world coordinate system) are n1, n2, and n3, the foreshortening ratios in the x-, y-, and z- directions are (n2

2 + n32)1/2, (n1

2 + n32)1/2, and (n1

2 + n22)1/2,

respectively.• Front, side, top views: n =

(1,0,0,0), (0,1,0,0), or (0,0,1,0) as in engineering drawings

Page 17: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

17

Types of Orthographic Projections

• Axonometric projections: attempts to portray general 3D shape– Isometric projection: all foreshortening ratio are

the same – Dimetric projection: exactly two are the same– Trimetric projection: all foreshortening ratio are

different

Page 18: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

18

Axonometric Projections

3

636

36

31

31

31

,,

0,,,

f

n 3

2232

322

31

37

31

,,

0,,,

f

n 75

747526

32

153

1537

33

,,

0,,,

f

n

Isometric Dimetric Trimetric

f: foreshortening ratios

Page 19: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

19

Example (Dimetric)

1000

0

0

0

0

98

97

91

97

92

97

91

97

98

31

37

31

M

n

TT

TT

TT

TT

zz

yy

xx

oo

1' 1100

1' 1010

1' 1001

1000' 1000

98

97

91

97

92

97

91

97

98

322

32

322

zo

yo

xo

Page 20: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

20

Page 21: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

21

Oblique Projection

• A particular parallel projection where direction of projection is not perpendicular to viewplane

v

n

Oblique projection not available in

OpenGL

Page 22: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

22

Cavalier Projection

Lines viewplane have f = 1Planar faces viewplane appear thicker

v

/4n

Properties:

viewplan

e

Page 23: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

23

Cabinet Projection

To overcome ‘thickness’ problem, choose f viewplane to be 1/2

Properties:

= arccot(2)

v

n

Page 24: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

24

Perspective Projection

• A perspective projection maps parallel lines in the space to parallel lines in the viewplane IFF the lines are parallel to the viewplane.

Page 25: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

25

Otherwise, they meet

Page 26: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

26

Vanishing Point

• Suppose (xi, yi, zi) i =1,2,3 are a set of mutually perpendicular vectors. The viewplane normal (n1, n2, n3) of a perspective projection can be perpendicular to (a) none (b) one (c) two of the vectors.

(a) (b) (c)

n

n

n

Page 27: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

27

Vanishing Point

• If a perspective projection maps a point-at-infinity (x,y,z,0) to a finite point (x’,y’,z’,1) on the viewplane, the lines in the direction (x,y,z) appear as lines converging to point on the (Cartesian) viewplane. The point (x’,y’,z’) is called the vanishing point in the direction (x,y,z).

Page 28: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

28

Three-point perspective

Two-point perspective

One-point perspective

Vanishing point

Page 29: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

29

IMAGE FORMATION – Perspective Imaging

Image courtesy of C. Taylor

“The Scholar of Athens,” Raphael, 1518

Page 30: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

30

Example

• Determine (and verify it is indeed so) the vanishing point of an OpenGL setting.

Eye = [15,0,0] Eye = [15,0,15]

Page 31: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

31

Numeric Example

TT

TT

TT

T

T

T

M

M

M

Verify

IvnvnM

n

v

003100010

1160150100

1150160001

:

30101

1516015

00310

1515016

1101

115015

4

How about (1,0,1,0)?

Viewpoint (15,0,15,1)Viewplane: x + z + 1 = 0

Page 32: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

32

Summary

• Projection– Parallel projection– Perspective projection

• Parallel projection– Orthographic

• Isometric• Dimetric• Trimetric

– Oblique• Cavalier• Cabinet

• Perspective projection– Three-point

perspective

– Two-point perspective

– One-point perspective

Understand how they are

differentiated

Page 33: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

33

Fig. 8. Constructing a perspective image of a house. (a) Drawing the floor plan and defining the viewing conditions (observer position and image plane). (b) Constructing a perspective view of the floor. (c) A reference height (in this case the height of an external wall) is drawn from the ground line and the first wall is constructed in perspective by joining the reference end points to the horizontal vanishing point v2. (d) All four external walls are constructed. (e) The elevations of all other objects (the door, windows and roofs) are first defined on the reference segment and then constructed in the rendered perspective view.

Page 34: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

34

Exercise

• Hand sketch a perspective drawing of a house

• Use Maxima to compute 2-point perspective projection, setting viewplane coordinate system

Page 35: 1 Projection. 2 Model Transform Viewing Transform Modelview Matrix world coordinates Pipeline Review Focus of this lecture.

35

Cross Ratio

The cross-ratio of every set of four collinear points shown in this figure has the same value

Cross ratio is preserved in projective geometry(ratio is NOT preserved)

z1z2 z3 z4