- 49 Views
- Uploaded on
- Presentation posted in: General

CAP 4703 Computer Graphic Methods

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

CAP 4703Computer Graphic Methods

Prof. Roy Levow

Chapter 5

- 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

- 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

- Classical (many)
- Orthographic
- One-, two-, and 3-point perspectives

- Computer
- Orthographic
- Perspective

- Principal face
- Primary surface of view
- Based on rectangular solid structures

- Primary surface of view
- Orthographic Projection
- Single view
- Multiview
- Show three orthogonal views

- 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

- 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

- 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

- Choose parallel or perspective view
- No separation of perspective degrees
- Two key elements
- Position camera
- Apply projection transformaton

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

- 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

- 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

- 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 */

- 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)

- Moving to 4 dimensions, consider
(wx, wy, wz, w)T

- Perspective transformation matrix
- 0 0 0takes
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

- 0 0 0takes
- Division by last coordinate gives
(xp, yp, d, 1), the projection

- Simply map z into zero

- Clipping region is a frustum, a truncated pyramid

- glFrustum(xmin, xmax, ymin, ymax,
near, far);

// left, right, top, bottom, near, far

- glOrtho(xmin, xmax, ymin, ymax,
near, far);

- Remove hidden surfaces
- Different view
- Visible-surface algoritims
- Identify visible surfaces

- Visible-surface algoritims
- Work in either
- Object space
- Image space

- 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

- Enable with
- glutInitDisplayMode(GLUT_DEPTH…);
- glEnabel(GL_DEPTH_TEST);

- Clear with
- glClear(GL_DEPTH_BUFFER_BIT);

- Move camera to view color cube from different locations
- cubeview.c

- 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

- Projectors do not need to be orthogonal to projection plane as in standard OpenGL projection
- Equivalent to a shear transformation of the objects

- 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

- Shadow
- projection of original polygon onto surface
- center of projection is light source
- shadow-polygon
- shadow.c