lecture 5 - projective transformation - normalized view volume - - - PowerPoint PPT Presentation

lecture 5
SMART_READER_LITE
LIVE PREVIEW

lecture 5 - projective transformation - normalized view volume - - - PowerPoint PPT Presentation

lecture 5 - projective transformation - normalized view volume - GL_PROJECTION matrix - clip coordinates - normalized device coordinates - planes and normals in projective space - Assignment 1 (python and pyopengl) Recall last lecture:


slide-1
SLIDE 1

lecture 5

  • projective transformation
  • normalized view volume
  • GL_PROJECTION matrix
  • clip coordinates
  • normalized device coordinates
  • planes and normals in projective space
  • Assignment 1 (python and pyopengl)
slide-2
SLIDE 2

Recall last lecture: view volume (view frustum) gluPerspective( y, x / y , near, far) glFrustrum( left, right, bottom, top, near, far)

slide-3
SLIDE 3

Recall last lecture: projection

f = -near

slide-4
SLIDE 4

But that is not what glFrustrum and gluPerspective do. Why not ? What do they do?

You might think.....

slide-5
SLIDE 5

The problem with projection:

If we discard the z information, then we don't know which

  • bjects are in front of which.
slide-6
SLIDE 6

Projective Transformation

projection plane (near)

slide-7
SLIDE 7

Projective Transformation

slide-8
SLIDE 8

Objects that are further away look smaller.

slide-9
SLIDE 9

How to define a projective transformation that does this ? Previously, we considered projection : But a projection matrix is not invertible (3rd and 4th rows are linearly dependent)

slide-10
SLIDE 10

Projective Transformation

z = -near z = - far

slide-11
SLIDE 11

We choose  and  to satisfy desired map illustrated on previous slide. where

slide-12
SLIDE 12

In Appendix to lecture notes, I derive (easy) : where

slide-13
SLIDE 13
slide-14
SLIDE 14
slide-15
SLIDE 15

Where do various regions map to ?

slide-16
SLIDE 16
slide-17
SLIDE 17
slide-18
SLIDE 18
slide-19
SLIDE 19
slide-20
SLIDE 20

Curious ! The JKL flipping is analogous to a Mobius strip.

slide-21
SLIDE 21

Why is the above detail important ?

We decide whether or not points lie in the view volume using projective space representation. To make these decisions correctly, we need to be careful about inequalities and signs. More about this later...

slide-22
SLIDE 22

Another (surprisingly) important detail: OpenGL uses the 2nd matrix above, not the first. Why ?

slide-23
SLIDE 23

Soon we will see why this is desirable.

slide-24
SLIDE 24

"Normalized view volume"

?

See next slide

slide-25
SLIDE 25

Map to normalized view volume

1) translate (left, bottom, -near) to (0,0,0) 2.) rescale x, y, z so volume is 2 x 2 x 2 and flip z axis

(into left handed coordinates !)

3.) translate so volume is centered at origin

slide-26
SLIDE 26

(w x, w y, w z, w) is in the normalized view volume if : w > 0 (Recall a few slides ago)

  • w <= w x <= w
  • w <= w y <= w
  • w <= w z <= w
slide-27
SLIDE 27

Putting in all together ...

slide-28
SLIDE 28
slide-29
SLIDE 29

"Clip Coordinates" Object Coordinates

slide-30
SLIDE 30

"Clip Coordinates" Object Coordinates

"Normalized Device Coordinates" "Perspective Division"

In OpenGL, this happens after clipping (next lecture)

slide-31
SLIDE 31
slide-32
SLIDE 32
slide-33
SLIDE 33
slide-34
SLIDE 34

The surface normal of a plane (triangle) does not necessarily get mapped to the surface normal of the mapped plane (triangle). Why not ? (Space is deformed, and so right angles are not preserved.)

slide-35
SLIDE 35
slide-36
SLIDE 36
slide-37
SLIDE 37
slide-38
SLIDE 38

except in special situations

slide-39
SLIDE 39

Announcements

Today is ADD/DROP deadline http://www.mcgill.ca/importantdates/key-dates For the Assignments, we will use PyOpenGL (Python). It is already installed on the lab computers. Fahim (T.A.) has posted instructions for you to install it on your computer: http://cim.mcgill.ca/~fmannan/comp557/Python%20and% 20PyOpenGL%20Installation.html If you need help with the installation, see him (or help each

  • ther -- please use the discussion board).

We will try to get the assignment out Thursday as originally planned.