1 / 31

CAP 4703 Computer Graphic Methods

CAP 4703 Computer Graphic Methods. Prof. Roy Levow Chapter 5. Viewing. Classical viewing Need to be able to reproduce classical views for a variety of applications Isometric Preserves measurements Elevation View a face of object Perspective Reflects size change of distant objects.

gurit
Download Presentation

CAP 4703 Computer Graphic Methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CAP 4703Computer Graphic Methods Prof. Roy Levow Chapter 5

  2. Viewing • Classical viewing • Need to be able to reproduce classical views for a variety of applications • Isometric • Preserves measurements • Elevation • View a face of object • Perspective • Reflects size change of distant objects

  3. Viewing Terminology • Center of Projection (COP) • Point where all projectors meet • Center of camera or eye lens • Origin of synthetic camera frame • Direction of Projection (DOP) • Direction of projectors when COP is moved to infinity

  4. Types of Viewing • Classical (many) • Orthographic • One-, two-, and 3-point perspectives • Computer • Orthographic • Perspective

  5. Classical Viewing Concepts • Principal face • Primary surface of view • Based on rectangular solid structures • Orthographic Projection • Single view • Multiview • Show three orthogonal views

  6. Axonometric Projections • Projectors are orthogonal to the projection plane but plane can be at angle to principal face • Isometric – symmetric with all three axes • Dimetric – symmetric with two axes • Trimetric – general case • Produces foreshortening of distances

  7. Oblique Projection • Most general parallel view • Projectors make arbitrary angle with projection plane • In computer graphics system, isometric, axonometric and oblique projections are all variations on one case

  8. Perspective • Characterized by diminution of size of more distant objects • Classically, viewer is symmetrical with respect to the projection plane • One-, two-, and three-point perspectives depending on number of vanishing points

  9. Computer Viewing • Choose parallel or perspective view • No separation of perspective degrees • Two key elements • Position camera • Apply projection transformaton

  10. OpenGL Camera • Default • Camera at origin • Pointing in negative z direction • Orthogonal view • Viewing volume is cube • Centered at origin • Side of length 2

  11. Default Camera

  12. Positioning Camera Frame • Can construct camera frame through translation and rotation of model view to get camera to desired viewing position from default position • For orthographic view, this does not change clipping volume set by glOrtho() • Size is unchanged • What is seen will change

  13. View as Change of Frames • Set View-Reference Point (VRP) • Center of camera • View plane defined by • View-plane normal (VPN) • View-up vector (VUP) • Project VUP onto projection plane to get up direction (vup) • Construct new frame with basis for view plane, u-v and normal n; u-v-n

  14. Look-At Positioning

  15. OpenGL Look-At • OpenGL simplifies camera positioning as follows • e = eye point • a = look-at point • Determines vpn as e – a glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz); /* define objects here */

  16. Perspective Projection • Note: x/z = xp/d or xp= x/(z/d) • Similarly for y • Provides non-uniform foreshortening • Perspective Transformation • (x, y, z) -> (xp, yp, zp)

  17. Perspective Projection (cont) • Moving to 4 dimensions, consider (wx, wy, wz, w)T • Perspective transformation matrix • 0 0 0 takes 0 1 0 0 (x, y, z, 1) T 0 0 1 0 to 0 0 1/d 0 (x, y, z, z/d) T • Division by last coordinate gives (xp, yp, d, 1), the projection

  18. Orthogonal Projection in OpenGL • Simply map z into zero

  19. Projection in OpenGL • Clipping region is a frustum, a truncated pyramid

  20. OpenGL Frustum • glFrustum(xmin, xmax, ymin, ymax, near, far); // left, right, top, bottom, near, far

  21. Parallel Viewing in OpenGL • glOrtho(xmin, xmax, ymin, ymax, near, far);

  22. Hidden Surface Removal • Remove hidden surfaces • Different view • Visible-surface algoritims • Identify visible surfaces • Work in either • Object space • Image space

  23. Z-Buffer Algorithm • Image Space • Requires depth buffer, called z-buffer to store depth • Depth resolution usually 16, 24, or 32 bits • As polygon is rasterized, depth is computed and compared with current z-buffer value; only nearer values update • Very efficient

  24. OpenGL Implementation • Enable with • glutInitDisplayMode(GLUT_DEPTH…); • glEnabel(GL_DEPTH_TEST); • Clear with • glClear(GL_DEPTH_BUFFER_BIT);

  25. Scene Walkthrough • Move camera to view color cube from different locations • cubeview.c

  26. Parallel-Projection Matrices • Previous projection matrices do not cover all possibilities • Projection Normalization • convert all projections to orthogonal • by distorting objects • distortion is called normalization • Map viewing volume into 2x2x2 cube at origin; translate and then scale

  27. Oblique Projection • Projectors do not need to be orthogonal to projection plane as in standard OpenGL projection • Equivalent to a shear transformation of the objects

  28. Perspective-Projection Matrices • Again, distort object • Skipping details • OpenGL Perspective Transformations 2z/(X-x) 0 (X+x)/(X-x) 0 0 2z/(Y-y) (Y+y)/(Y-y) 0 0 0 -(f+n)/(f-n) -2fn/(f-n) 0 0 -1 0

  29. Projections and Shadows • Shadow • projection of original polygon onto surface • center of projection is light source • shadow-polygon • shadow.c

More Related