Download presentation

Presentation is loading. Please wait.

Published byAlessandra Lowery Modified over 2 years ago

1
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing

2
Computer Graphics 21/10/2008Lecture 82 Parallel projections. Specified by a direction to the centre of projection, rather than a point. –Centre of projection at infinity. Orthographic –The normal to the projection plane is the same as the direction to the centre of projection. Oblique –Directions are different.

3
Computer Graphics 21/10/2008Lecture 83 Mathematics of Viewing We need to generate the transformation matrices for perspective and parallel projections. They should be 4x4 matrices to allow general concatenation. And there’s still 3D clipping and more viewing stuff to look at.

4
Computer Graphics 21/10/2008Lecture 84 Perspective projection – simplest case. d x y z Projection Plane. P(x,y,z) P p (x p,y p,d) Centre of projection at the origin, Projection plane at z=d.

5
Computer Graphics 21/10/2008Lecture 85 Perspective projection – simplest case. d x y z P(x,y,z) P p (x p,y p,d) z P(x,y,z) d z d y x xpxp ypyp

6
Computer Graphics 21/10/2008Lecture 86 Perspective projection.

7
Computer Graphics 21/10/2008Lecture 87 Perspective projection.

8
Computer Graphics 21/10/2008Lecture 88 Perspective projection. Trouble with this formulation : Centre of projection fixed at the origin.

9
Computer Graphics 21/10/2008Lecture 89 Finding vanishing points. Recall : An axis vanishing point is the point where the axis intercepts the projection plane point at infinity.

10
Computer Graphics 21/10/2008Lecture 810 Alternative formulation. z P(x,y,z) d x xpxp z d y ypyp Projection plane at z = 0 Centre of projection at z = -d

11
Computer Graphics 21/10/2008Lecture 811 Alternative formulation. z P(x,y,z) d x xpxp z d y ypyp Projection plane at z = 0, Centre of projection at z = -d Now we can allow d

12
Computer Graphics 21/10/2008Lecture 812 Stereo Projection Stereo projection is just two perspective projections : object Left eye Right eye z x r r l l display screen Max effect at 50cm E E

13
Computer Graphics 21/10/2008Lecture 813 Stereo Projection E is the interocular separation, typically 2.5cm to 3cm. d is the distance of viewer from display, typically 50cm. Let 2E = 5cm:

14
Computer Graphics 21/10/2008Lecture 814 View as an anaglyph

15
Computer Graphics 21/10/2008Lecture 815 Orthographic projection. Orthographic Projection onto a plane at z = 0. x p = x, y p = y, z = 0.

16
Computer Graphics 21/10/2008Lecture 816 Implementation of viewing. Transform into world coordinates. Perform projection into view volume or eye coordinates. Clip geometry outside the view volume. Perform projection into screen coordinates. Remove hidden lines.

17
Computer Graphics 21/10/2008Lecture 817 3D clipping. For orthographic projection, view volume is a box. For perspective projection, view volume is a frustrum. Far clipping plane. Near clipping plane left right Need to calculate intersection With 6 planes.

18
Computer Graphics 21/10/2008Lecture 818 Speeding up projection. Can always place camera at origin ! –OpenGL, Renderman. Much easier to clip lines to unit cube –Define canonical view volumes. –Define normalising transformations that project view volume into canonical view volume. –Clip, transform to screen coordinates.

19
Computer Graphics 21/10/2008Lecture 819 3D clipping. Can use Cohen-Sutherland algorithm. –Now 6-bit outcode. –Trivial acceptance where both endpoint outcodes are all zero. –Perform logical AND, reject if non-zero. –Find intersect with a bounding plane and add the two new lines to the line queue. –Line-primitive algorithm.

20
Computer Graphics 21/10/2008Lecture 820 3D polygon clipping. Sutherland-Hodgman extends easily to 3D. Call ‘CLIP’ 6 times rather than 4. Polygon-primitive algorithm.

21
Computer Graphics 21/10/2008Lecture 821 Sutherland-Hodgman algorithm. Four cases of polygon clipping : InsideOutsideInsideOutsideInsideOutsideInsideOutside Case 3 No output. Case 1 Output Vertex Case 2. Output Intersection Case 4 Second Output First Output

22
Computer Graphics 21/10/2008Lecture 822 Clipping and homogeneous coordinates. Efficient to transform frustrum into perspective canonical view volume – unit slope planes. Even better to transform to parallel canonical view volume –Clipping must be done in homogeneous coordinates. Points can appear with –ve W and cannot be clipped properly in 3D.

23
Computer Graphics 21/10/2008Lecture 823 Transforming between canonical view-volumes The perspective canonical view-volume can be transformed to the parallel canonical view-volume with the following matrix: Derivation left as an exercise.

24
Computer Graphics 21/10/2008Lecture 824 Clipping in 3D. 3D parallel projection volume is defined by: -1 x 1, -1 y 1, -1 z 0 Replace by X/W,Y/W,Z/W: -1 X/W 1, -1 Y/W 1, -1 Z/W 0 Corresponding plane equations are : X= -W, X=W, Y=-W, Y=W, Z=-W, Z=0

25
Computer Graphics 21/10/2008Lecture 825 Clipping in W If W>0, multiplication by W doesn’t change sign. W>0: -W X W, -W Y W, -W Z 0 However if W<0, need to change sign : W<0: -W X W,-W Y W, -W Z 0

26
Computer Graphics 21/10/2008Lecture 826 Points in Homogeneous coordinates. X or Y W W=1 P 1 =[1 2 3 4] T P 2 =[-1 –2 –3 –4] T Projection of P1 and P2 onto W=1 plane

27
Computer Graphics 21/10/2008Lecture 827 Points in Homogeneous coordinates. X or Y W W=1 P 1 =[1 2 3 4] T P 2 =[-1 –2 –3 –4] T Projection of P1 and P2 onto W=1 plane Region A Region B Need to consider both regions when Performing clipping.

28
Computer Graphics 21/10/2008Lecture 828 Clipping in Homogeneous coordinates Could clip twice – once for region B, once for region A. –Expensive. Check for negative W values and negate points before clipping. What about lines with endpoints in each region ?

29
Computer Graphics 21/10/2008Lecture 829 Lines in Homogeneous coordinates. X W P1 P2 W=1 Projection of points.

30
Computer Graphics 21/10/2008Lecture 830 Lines in Homogeneous coordinates. X W P1 P2 W=1 W=-X W=XClipped lines Solution : Clip line segments, negate both endpoints, clip again.

31
Computer Graphics 21/10/2008Lecture 831 Final step. Divide by W to get back to 3-D –Divide by z. –Where the perspective projection actually gets done – perspective foreshortening. Now we have a ‘view volume’. –Don’t flatten z due to hidden line calculations.

32
Computer Graphics 21/10/2008Lecture 832 Summary. Orthographic matrix - replace (z) axis with point. Perspective matrix – multiply w by z. –Clip in homogeneous coordinates. –Preserve z for hidden surface calculations. –Can find number of vanishing points.

33
Computer Graphics 21/10/2008Lecture 833 Reading for Arbitrary Viewing I and II Foley et al. Chapter 6 – all of it, –Particularly section 6.5 Introductory text, Chapter 6 – all of it, –Particularly section 6.6 This will cover both this handout and the previous handout.

Similar presentations

OK

1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:

1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on electric motor class 10 Ppt on live line maintenance tools Motivational ppt on life Ppt on needle stick injury infection Ppt on advertising media planning Ppt on cross docking operations Ppt on growing old gracefully Ppt on conservation of environment quotes Ppt on child labour laws in india Ppt on mpeg audio compression and decompression files