Download presentation

Presentation is loading. Please wait.

Published byJoseph White Modified over 2 years ago

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

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

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

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

5
5GR2-00 Perspective and Parallel Projection n Parallel projection preserves the relative proportions of objects, but does not give a realistic view n 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

6
6GR2-00 Perspective and Parallel Projection perspective parallel

7
7GR2-00 Puzzle

8
8GR2-00 Another Example

9
9GR2-00 Viewing Coordinate System viewing co-ordinate system n 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 xVxV yVyV zVzV Camera is positioned at: (0, 0, z C )

10
10GR2-00 View Plane n We assume the view plane is perpendicular to the viewing direction The view plane is positioned at: (0, 0, z VP ) Let d = z C - z VP be the distance between the camera and the plane xvxv yvyv zvzv

11
11GR2-00 Perspective Projection Calculation xvxv yvyv zvzv zVzV view plane Q camera yVyV zCzC zQzQ z VP looking along x-axis

12
12GR2-00 Perspective Projection Calculation zVzV view plane Q camera yVyV P By similar triangles, y P / y Q = (z C - z VP ) / (z C - z Q ) and so y P = y Q * (z C - z VP ) / (z C - z Q ) or y P = y Q * d / (z C - z Q ) zCzC zQzQ z VP x P likewise

13
13GR2-00 Using Matrices and Homogeneous Coordinates n We can express the perspective transformation in matrix form n Point Q in homogeneous coordinates is (x Q, y Q, z Q, 1) n We shall generate a point H in homogeneous coordinates (x H, y H, z H, w H ), where w H is not 1 n But the point (x H /w H, y H /w H, z H /w H, 1) is the same as H in homogeneous space n This gives us the point P in 3D space, ie x P = x H /w H, simly for y P

14
14GR2-00 Transformation Matrix for Perspective 1 0 0 0 0 1 0 0 0 0 -z VP /d z VP z C /d 0 0 -1/d z C /d xQyQzQ1xQyQzQ1 xHyHzHwHxHyHzHwH = Then x P = x H / w H ie x P = x H / ( (z C - z Q ) / d ) ie x P = x Q / ( (z C - z Q ) / d ) y P likewise

15
15GR2-00 Exercises n There are two special cases which you can now derive: – camera at the origin (z C = 0) – view plane at the origin (z VP = 0) n Follow through the operations just described for these two cases, and write down the transformation matrices

16
16GR2-00 Note for Later n 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
17GR2-00 Vanishing Points vanishing point n 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 view plane vanishing point one-point perspective projection of cube

18
18GR2-00 One- and Two-Point Perspective Drawing

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

20
20GR2-00 Two-point Perspective Edward Hopper Lighthouse at Two Lights -see www.postershop.com

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

22
22GR2-00 Parallel Projection Calculation xvxv yvyv zvzv zVzV view plane Q yVyV zQzQ z VP looking along x-axis

23
23GR2-00 Parallel Projection Calculation zVzV view plane Q yVyV P y P = y Q and similarly x P = x Q

24
24GR2-00 Parallel Projection Calculation n So this is much easier than perspective! – x P = x Q – y P = y Q – z P = z VP n The transformation matrix is simply 1 0 0 0 0 1 0 0 0 0 z VP /z Q 0 0 0 0 1

25
25GR2-00 View Volumes - View Window n 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 view window n Analogy in computer graphics is the view window, a rectangle in the view plane xvxv yvyv zvzv view window

26
26GR2-00 View Volume - Front and Back Planes n We will also typically want to limit the view in the z V direction n We define two planes, each parallel to the view plane, to achieve this – front plane (or near plane) – back plane (or far plane) front plane back plane zVzV

27
27GR2-00 View Frustum - Perspective Projection view window back plane front plane camera view frustum zVzV

28
28GR2-00 View Volume - Parallel Projection view window back plane front plane zVzV view volume

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

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google