Presentation is loading. Please wait.

Presentation is loading. Please wait.

GR2 Advanced Computer Graphics AGR

Similar presentations

Presentation on theme: "GR2 Advanced Computer Graphics AGR"— Presentation transcript:

1 GR2 Advanced Computer Graphics AGR
Lecture 3 Viewing - Projections 1

2 Viewing Graphics display devices are 2D rectangular screens
Hence we need to understand how to transform our 3D world to a 2D surface This involves: selecting the observer position (or camera position) selecting the view plane (or camera film plane) selecting the type of projection 2

3 Perspective Projections
There are two types of projection: perspective and parallel In a perspective projection, object positions are projected onto the view plane along lines which converge at the observer P1 P1’ camera P2 P2’ view plane 3

4 Parallel Projection In a parallel projection, the observer position is at an infinite distance, so the projection lines are parallel P1 P2 view plane 4

5 Perspective and Parallel Projection
Parallel projection preserves the relative proportions of objects, but does not give a realistic view Perspective projection gives realistic views, but does not preserve proportions Projections of distant objects are smaller than projections of objects of the same size which are closer to the view plane 5

6 Perspective and Parallel Projection

7 Puzzle

8 Another Example

9 Viewing Coordinate System
Viewing is easier if we work in a viewing co-ordinate system, where the observer or camera position is on the z-axis, looking along the negative z-direction xV yV zV Camera is positioned at: (0 , 0, zC) 6

10 View Plane We assume the view plane is perpendicular to the viewing direction xv yv zv The view plane is positioned at: (0, 0, zVP) Let d = zC - zVP be the distance between the camera and the plane 7

11 Perspective Projection Calculation
xv yv zv zV view plane Q camera yV zQ zVP zC looking along x-axis 8

12 Perspective Projection Calculation
zV view plane Q camera yV P zQ zVP zC By similar triangles, yP / yQ = (zC - zVP) / (zC - zQ) and so yP = yQ * (zC - zVP) / (zC - zQ) or yP = yQ * d / (zC - zQ) xP likewise 9

13 Using Matrices and Homogeneous Coordinates
We can express the perspective transformation in matrix form Point Q in homogeneous coordinates is (xQ, yQ, zQ, 1) We shall generate a point H in homogeneous coordinates (xH, yH, zH, wH), where wH is not 1 But the point (xH/wH, yH/wH, zH/wH, 1) is the same as H in homogeneous space This gives us the point P in 3D space, ie xP = xH/wH, sim’ly for yP 10

14 Transformation Matrix for Perspective
xQ yQ zQ 1 xH yH zH wH = zVP/d zVPzC/d /d zC/d Then xP = xH / wH ie xP = xH / ( (zC - zQ) / d ) xP = xQ / ( (zC - zQ) / d ) yP likewise 11

15 Exercises There are two special cases which you can now derive:
camera at the origin (zC = 0) view plane at the origin (zVP = 0) Follow through the operations just described for these two cases, and write down the transformation matrices 12

16 Note for Later The original z co-ordinate of points is retained
we need relative depth in the scene in order to sort out which faces are visible to the camera

17 Vanishing Points When a 3D object is projected onto a view plane using perspective, parallel lines in object NOT parallel to the view plane converge to a vanishing point vanishing point one-point perspective projection of cube view plane 13

18 One- and Two-Point Perspective Drawing

19 One-point Perspective
This is: Trinity with the Virgin, St John and Donors, by Mastaccio in 1427 Said to be the first painting in perspective

20 Two-point Perspective
Edward Hopper Lighthouse at Two Lights -see

21 Parallel Projection - Two types
Orthographic parallel projection has view plane perpendicular to direction of projection Oblique parallel projection has view plane at an oblique angle to direction of projection P1 P1 P2 P2 view plane view plane We shall only consider orthographic projection 14

22 Parallel Projection Calculation
xv yv zv zV view plane Q yV zQ zVP looking along x-axis 15

23 Parallel Projection Calculation
zV view plane Q yV P yP = yQ and similarly xP = xQ 16

24 Parallel Projection Calculation
So this is much easier than perspective! xP = xQ yP = yQ zP = zVP The transformation matrix is simply zVP/zQ 0 17

25 View Volumes - View Window
Type of lens in a camera is one factor which determines how much of the view is captured wide angle lens captures more than regular lens Analogy in computer graphics is the view window, a rectangle in the view plane view window xv yv zv 18

26 View Volume - Front and Back Planes
We will also typically want to limit the view in the zV direction We define two planes, each parallel to the view plane, to achieve this front plane (or near plane) back plane (or far plane) zV back plane front plane 19

27 View Frustum - Perspective Projection
back plane view frustum view window camera front plane zV 20

28 View Volume - Parallel Projection
back plane view volume view window front plane zV 21

29 View Volume The front and back planes act as important clipping planes
Can be used to select part of a scene we want to view Front plane important in perspective to remove near objects which will swamp picture 22

Download ppt "GR2 Advanced Computer Graphics AGR"

Similar presentations

Ads by Google