Top Banner
1 of 19 New Lecture And Lab Information Lectures: – Thursday 13:00 – 14:00 (A322) • Does anyone miss lunch? – Friday 15:00 – 16:00 (A28) Labs: – Wednesday 10:00 – 11:00 (A305) – Wednesday 17:00 – 18:00 (Aungier St. 1-005) Sorry for all of the messing around!
19

1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

1of19

New Lecture And Lab Information

Lectures:– Thursday 13:00 – 14:00 (A322)

• Does anyone miss lunch?

– Friday 15:00 – 16:00 (A28)

Labs:– Wednesday 10:00 – 11:00 (A305)– Wednesday 17:00 – 18:00 (Aungier St. 1-005)

Sorry for all of the messing around!

Page 2: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

Course Website: http://www.comp.dit.ie/bmacnamee

Computer Graphics 8:Perspective Projections

Page 3: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

3of19

Contents

In today’s lecture we are going to have a look at how perspective projections work in computer graphics

Page 4: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

4of19

Perspective Projections

Remember the whole point of perspective projections

Imag

es t

aken

fro

m H

earn

& B

aker

, “C

ompu

ter

Gra

phic

s w

ith O

penG

L” (

2004

)

Page 5: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

5of19

Projection Calculations

x axis

y axis

z axis

P=(x, y, z)

(xprp, yprp, zprp)(xp, yp, zp)

View Plane

Page 6: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

6of19

Projection Calculations (cont…)

Any point along the projector (x’, y’, z’) can be given as:

When u = 0 we are at P, while when u = 1 we are at the Projection Reference Point

uzzzz

uyyyy

uxxxx

prp

prp

prp

)('

)('

)('

10 u

Page 7: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

7of19

Projection Calculations (cont…)

At the view plane z’ = zvp so we can solve the

z’ equation for u:

zz

zzu

prp

vp

Page 8: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

8of19

Projection Calculations (cont…)

Armed with this we can restate the equations for x’ and y’ for general perspective:

zz

zzy

zz

zzyy

zz

zzx

zz

zzxx

prp

vpprp

prp

vpprpvp

prp

vpprp

prp

vpprpvp

Page 9: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

9of19

Perspective Projection Transformation Matrix

Because the x and y coordinates of a projected point are expressed in terms of z we need to do a little work to generate a perspective transformation matrix

First we use a homogeneous representation to give xvp and yvp as:

where:h

xx h

vp h

yy h

vp

zzh prp

Page 10: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

10of19

Perspective Projection Transformation Matrix (cont…)

From the previous equations for xvp and yvp

we can see that:

zzyzzyy

zzxzzxx

vpprpvpprph

vpprpvpprph

Page 11: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

11of19

Perspective Projection Transformation Matrix (cont…)

Now we can set up a transformation matrix, that only contains perspective parameters, to convert a spatial position to homogeneous coordinates

First we calculate the homogeneous coordinates using the perspective-transformation matrix:

where Ph is the homogeneous point (xh, yh, zh, h) and P is the coordinate position (x, y, z, 1)

PMP persh

Page 12: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

12of19

Perspective Projection Transformation Matrix (cont…)

Setting up the matrix so that we calculate xh

and yh is straightforward

However, we also need to preserve the z values – depth information

Otherwise the z coordinates are distorted by the homogeneous parameter hWe don’t need to worry about the details here, but it means extra parameters (sz and tz)

are added to the matrix

Page 13: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

13of19

Perspective Projection Transformation Matrix (cont…)

The following is the perspective projection matrix which arises:

prp

zz

prpprpprpvpprp

prpprpprpvpprp

pers

z

ts

zyyzz

zxxzz

M

100

00

0

0

Page 14: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

14of19

Setting Up A Perspective Projection

A perspective projection can be set up by specifying the position and size of the view plane and the position of the projection reference point

However, this can be kind of awkward

Imag

es t

aken

fro

m H

earn

& B

aker

, “C

ompu

ter

Gra

phic

s w

ith O

penG

L” (

2004

)

Page 15: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

15of19

Setting Up A Perspective Projection (cont…)

The field of view angle can be a more intuitive way to specify perspective projections

This is analogous to choosing a lense for a camera

Field of viewImag

es t

aken

fro

m H

earn

& B

aker

, “C

ompu

ter

Gra

phic

s w

ith O

penG

L” (

2004

)

Page 16: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

16of19

Setting Up A Perspective Projection (cont…)

Increasing the field of view angle increases the height of the view plane and so increases foreshortening

Imag

es t

aken

fro

m H

earn

& B

aker

, “C

ompu

ter

Gra

phic

s w

ith O

penG

L” (

2004

)

Page 17: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

17of19

Setting Up A Perspective Projection (cont…)

The amount of foreshortening that is present can greatly affect the appearance of our scenes

Page 18: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

18of19

Setting Up A Perspective Projection (cont…)

We need one more thing to specify a perspective projections using the filed of view angle

The aspect ratio gives the ratio between the width sand height of the view plane

Page 19: 1 of 19 New Lecture And Lab Information Lectures: –Thursday 13:00 – 14:00 (A322) Does anyone miss lunch? –Friday 15:00 – 16:00 (A28) Labs: –Wednesday 10:00.

19of19

Summary

In today’s class we looked at the detail of generating a perspective projection of a three dimensional scene