Definitions View Space : coordinate system with the viewer looking - - PowerPoint PPT Presentation

definitions
SMART_READER_LITE
LIVE PREVIEW

Definitions View Space : coordinate system with the viewer looking - - PowerPoint PPT Presentation

Perspective Projection 1 Dr. Mihail September 6, 2016 1 Some of the images in these slides are taken from Dr. Stephen Chenney graphics course at UW Madison http://research.cs.wisc.edu/graphics/Courses/559-s2002/ (Dr. Mihail) 3D graphics


slide-1
SLIDE 1

Perspective Projection1

  • Dr. Mihail

September 6, 2016

1Some of the images in these slides are taken from Dr. Stephen Chenney graphics

course at UW Madison http://research.cs.wisc.edu/graphics/Courses/559-s2002/

(Dr. Mihail) 3D graphics September 6, 2016 1 / 24

slide-2
SLIDE 2

Definitions

View Space: coordinate system with the viewer looking down the -z axis, with +x to the right and +y up World-View Transformation: takes points in world space and converts them into points in view space Projection Transformation: takes points in view space and converts them into points in Canonical View Space Canonical View Space: coordinate system with the viewer looking along -z, +x to the right and +y up. Here everything inside the cube x:[-1, 1], y:[-1, 1], z:[-1, 1] using orthogonal projection.

(Dr. Mihail) 3D graphics September 6, 2016 2 / 24

slide-3
SLIDE 3

Perspective Projection

(Dr. Mihail) 3D graphics September 6, 2016 3 / 24

slide-4
SLIDE 4

One Point Perspective

https://www.youtube.com/watch?v=qmSg_F4P5yU

(Dr. Mihail) 3D graphics September 6, 2016 4 / 24

slide-5
SLIDE 5

Two Point Perspective

https://www.youtube.com/watch?t=52&v=7ZYBWA-ifEs

(Dr. Mihail) 3D graphics September 6, 2016 5 / 24

slide-6
SLIDE 6

Three Point Perspective

https://www.youtube.com/watch?v=BfHRReALvVc

(Dr. Mihail) 3D graphics September 6, 2016 6 / 24

slide-7
SLIDE 7

Simple Perspective Transformation

(Dr. Mihail) 3D graphics September 6, 2016 7 / 24

slide-8
SLIDE 8

Simple Perspective Transformation

By similar triangles

(Dr. Mihail) 3D graphics September 6, 2016 8 / 24

slide-9
SLIDE 9

Simple Perspective Transformation

Using homogeneous coordinates

(Dr. Mihail) 3D graphics September 6, 2016 9 / 24

slide-10
SLIDE 10

Simple Perspective Transformation

One can write a line in parametric form: x = x0 + td x0 is a point on a line, t is a scalar (distance along the line from x0) and d is a direction (unit length) Different x0 gives different parallel lines     x y z w     =     1 1 1

1 f

        x0 y0 z0 1     + t     1 1 1

1 f

        xd yd zd     =  

x0+txd z0+tzd y0+tyd z0+tzd

1   Taking the limit as t → ∞, we get   

fxd zd fyd zd

f   

(Dr. Mihail) 3D graphics September 6, 2016 10 / 24

slide-11
SLIDE 11

Simple Perspective Transformation

Problems

This does not map points to a Canonical View Volume Insufficient for all applications (e.g., depth testing, because we throw away information)

(Dr. Mihail) 3D graphics September 6, 2016 11 / 24

slide-12
SLIDE 12

Orthographic View Volume

(Dr. Mihail) 3D graphics September 6, 2016 12 / 24

slide-13
SLIDE 13

Perspective View Volume

(Dr. Mihail) 3D graphics September 6, 2016 13 / 24

slide-14
SLIDE 14

Perspective View Volume

Near and far planes are parallel to the image plane zv = n, zv = f Other planes all pass through the center of projection Left and right planes intersect the image planes in vertical lines The top and bottom planes intersect the image plane in horizontal lines

(Dr. Mihail) 3D graphics September 6, 2016 14 / 24

slide-15
SLIDE 15

Perspective View Volume

(Dr. Mihail) 3D graphics September 6, 2016 15 / 24

slide-16
SLIDE 16

Perspective View Volume

(Dr. Mihail) 3D graphics September 6, 2016 16 / 24

slide-17
SLIDE 17

Perspective View Volume

Can convert from image height to FOV or viceversa.

(Dr. Mihail) 3D graphics September 6, 2016 17 / 24

slide-18
SLIDE 18

Perspective View Volume

Symmetry.

(Dr. Mihail) 3D graphics September 6, 2016 18 / 24

slide-19
SLIDE 19

Transformation

We need a matrix that transforms

(Dr. Mihail) 3D graphics September 6, 2016 19 / 24

slide-20
SLIDE 20

Transformation

We need a matrix that transforms

(Dr. Mihail) 3D graphics September 6, 2016 20 / 24

slide-21
SLIDE 21

Transformation

Convert the perspective case to orthographic so we can use the canonical view space in the existent pipeline The intersection of lines with the near clip plane should not change

(Dr. Mihail) 3D graphics September 6, 2016 21 / 24

slide-22
SLIDE 22

General Perspective

Mp =     1 1

n+f n

−f

1 n

    ≡     n n

n+f n

−nf 1     This matrix leaves points with z = n unchanged It maps depth properly We can multiply a homogeneous matrix by any number without changing the final point, so the two matrices have the same effect

(Dr. Mihail) 3D graphics September 6, 2016 22 / 24

slide-23
SLIDE 23

MV.js perspective()

1 function perspective( fovy , aspect , near , far ) 2 { 3 var f = 1.0 / Math.tan( radians(fovy) / 2 ); 4 var d = far - near; 5 6 var result = mat4 (); 7 result [0][0] = f / aspect; 8 result [1][1] = f; 9 result [2][2] = -(near + far) / d; 10 result [2][3] = -2 * near * far / d; 11 result [3][2] =

  • 1;

12 result [3][3] = 0.0; 13 14 return result; 15 }

(Dr. Mihail) 3D graphics September 6, 2016 23 / 24

slide-24
SLIDE 24

MV.js perspective()

f =

1 tan−1( fovy

2 )

d = far − near

The Matrix

Mp =    

f a

f

−n+f d 2nf d

−1    

(Dr. Mihail) 3D graphics September 6, 2016 24 / 24