Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chi-Cheng Lin, Winona State University CS430 Computer Graphics 3D Viewing and Projections.

Similar presentations


Presentation on theme: "Chi-Cheng Lin, Winona State University CS430 Computer Graphics 3D Viewing and Projections."— Presentation transcript:

1 Chi-Cheng Lin, Winona State University CS430 Computer Graphics 3D Viewing and Projections

2 2 Topics l Synthetic Camera l Steps in 3D Viewing l Projections l Perspective Projections l Parallel Projections l Specification of an Arbitrary 3D View l Graphics Pipeline Revisited

3 3 Synthetic Camera l Metaphor for creating 3D scenes: l Coordinate system: zCamera: u, v, n zObject: x, y, z

4 4 Steps in 3D Viewing l Projection type specification zWhy projection? yObjects 3D, device 2D zTwo most important yPerspective yParallel orthographic l Viewing parameter specification zViewing plane zViewing (eye) coordinate system zScene coordinate system

5 5 Steps in 3D Viewing l 3D clipping zClip against view volume l Projection and display zWindow to viewport transformation l Conceptual model of 3D viewing process

6 6 Projections l Projection zTransformation from n-D coordinate system to m-D coordinate system, where m < n l Our concern zn = 3 and m = 2  projection from 3D to 2D l Terminology zProjectors: Straight projection rays zCenter of projection: Where the projectors emanated from zProjection plane: Where the projection forms

7 7 Projections l Projection from 3D to 2D defined by zProjectors emanate from COP, pass though each point of the object, and intersect the projection plane l Planar geometric projections zProjection is onto a plane zReferred to as "projections" here

8 8 Projections l Two Basic Classes zPerspective zParallel l Perspective zDistance between projection plane and COP is finite zVisual effect similar to human visual system yPerspective foreshortening: distance from COP longer, size smaller zExact shape, measurement, parallelism not reserved

9 9 Projections l Parallel zDistance between projection plane and COP is infinite zLess realistic view yNo foreshortening zExact measurement and parallelism preserved PerspectiveParallel

10 10 Perspective Projections l Vanishing Point zPoint that set of parallel lines not parallel to the projection plane converge to zProjection of a point at infinity l Axis Vanishing Point zVanishing point of set of lines parallel to one of three principle axes zAt most 3: yx-axis vanishing point yy-axis vanishing point yz-axis vanishing point

11 11 Perspective Projections l Example: zIf projection plane cuts only z-axis yOnly z-axis vanishing point yAs lines parallel to x or y axis also parallel to projection plane l Number of Axis Vanishing Points zCan be used to categorize perspective projections zEqual to number of axes cut by projection plane

12 12 Number of Axis Vanishing Points l One-point l Three-point: hardly used

13 13 Number of Axis Vanishing Points l Two-point zCommonly used in architecture, engineering, industrial design, and advertising drawings

14 14 Parallel Projections l Two types, defined by zDirection of projection (DOP) zViewing (projection) plane normal (VPN) l Orthographic zDOP and VPN the same (or the reverse) l Obliuqe zDOP of VPN not the same (nor the reverse)

15 15 Orthographic Parallel Projections l Projection plane perpendicular to a principle axis l Most common types zFront-elevation zTop-elevation (plane-elevation) zSide-elevation l Used in engineering drawing (such as machine parts) l Hard to deduce 3D nature

16 16 Orthographic Parallel Projections

17 17 Orthographic Parallel Projections l Axonometric orthographic projections zProjection plane not normal to a principle axis zSeveral faces of an object can be shown at once zParallalism reserved, distances can be measured zExample: Isometric projection yVPN = DOP = (dx, dy, dz), where |dx| = |dy| = |dz| y8 directions

18 18 Obliuqe Parallel Projections l Projection plane normal and DOP differ l Projection plane is normal to a principle axis l Measurement of distance and angle of faces parallel to the plane allowed l Widely used (easy to draw) l Cavalier zDOP makes 45 degree with projection plane l Cabinet zDOP makes angle of arctan(2) with projection plane

19 19 Obliuqe Parallel Projections l CavalierCabinet 1 1 1 1/2

20 20 Classification of Planar Geometric Projections

21 21 Specification of an Arbitrary 3D View l View Plane zProjection Plane zDefined by yVRP (View Reference Point) –look at point in OpenGL yVPN (View Plane Normal) –(eye - look) in OpenGL

22 22 Specification of an Arbitrary 3D View l Window zSimilar to the window in 2D zContents mapped to the viewport zProjection on the view plane outside the window not shown zSpecification needs the following yMinimum and maximum window coordinates yTwo orthogonal axes zCan be defined by view volume

23 23 Specification of an Arbitrary 3D View l PRP (Projection Reference Point) zParallel: DOP = from PRP to CW zPerspective: COP z“Eye” in OpenGL l View volume zClipping and projection zPerspective ySemi-infinite pyramid with apex at PRP and edges passing through window corners zParallel yInfinite parallelepiped with sides parallel to DOP

24 24 Specification of an Arbitrary 3D View l View volume (cont’d) zFinite view volume yFront clipping plane –Parallel to VRP –Specified by F (front distance) = distance(FCP - VRP) yBack clipping plane –Parallel to VRP –Specified by B (back distance) = distance(BCP - VRP) yIn OpenGL, “near” and “far” represents “front” and “back”, respectively, in the camera coordinate

25 25 Finite View Volumes Perspective Parallel

26 26 Specification of an Arbitrary 3D View l Mapping from view volume to 2D display zView volume --> NPC (Normalized Projection Coordinates), i.e., standard cube z3D viewport specified in NPC zz=1 face of NPC cube mapped to display zIf wire-frame, z coordinate discarded zIf surface, hidden-surface removal

27 27 Graphics Pipeline Revisited l Perspective projection VMP clip VpVp modelview matrix projection matrix viewport matrix perspective division screen coordinates normalized device coordinates clip coordinates VMP clip VpVp modelview matrix projection matrix viewport matrix perspective division screen coordinates normalized device coordinates clip coordinates eye coordinates

28 28 Perspective Viewing with OpenGL l Perspectival transformation l Camera for perspective projection zglMatrixMode(GL_PROJECTION); glLoadIdentity(); glPerspective(viewAngle, aspectRatio, N, F) zExample: glPerspective(60.0, 1.5, 0.3, 50.0) zNear plane serves as the view plane eye 1 2 1 2y z

29 29 Perspective Viewing with OpenGL  y z x eye N F N F y 

30 30 Perspective Viewing with OpenGL l Positioning and aiming camera zglMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eye.x, eye.y, eye.z, // eye position look.x, look.y, look.z, // look at point up.x, up.y, up.z) // up vector zUp vector is often set to (0, 1, 0)

31 31 Transformation Matrix for LookAt l Camera coordinate system zAxes: u, v, n n = eye – look u = up  n v = n  u zOrigin: eye (looking in the direction –n) zIf up = (0, 1, 0) then u = (n z, 0, -n x ) i.e., horizontal v = (-n x n y, n x 2 +n z 2, -n z n y ) i.e., more or less upward

32 32

33 33 Transformation Matrix for LookAt l Transformation matrix l Verify that V transformed zeye to (0, 0, 0, 1) zu to i = (1, 0, 0, 0) zv to j = (0, 1, 0, 0) zn to k = (0, 0, 1, 0)

34 34

35 35


Download ppt "Chi-Cheng Lin, Winona State University CS430 Computer Graphics 3D Viewing and Projections."

Similar presentations


Ads by Google