Chapters 5 - PowerPoint PPT Presentation

About This Presentation
Title:

Chapters 5

Description:

Classical and Computer Viewing. Perspective views. fixed Center of Projection (COP) ... Programmer has two styles of specifying transformations ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 23
Provided by: sie6
Learn more at: https://www.cs.unca.edu
Category:
Tags: chapters

less

Transcript and Presenter's Notes

Title: Chapters 5


1
Chapters 5
  • 2 March 2004

2
Classical Computer Viewing
  • Same elements
  • objects
  • viewer
  • projectors
  • projection plane

3
Classical and Computer Viewing
  • Perspective views
  • fixed Center of Projection (COP)
  • Parallel Views
  • COP at infinity

4
Viewing in OpenGL
  • Perspective
  • Parallel - Orthogonal

5
Perspective viewing
  • glMatrixMode(GL_PROJECTION)
  • gluPerspective(40.0, 1.0, 1.0, 40.0)
  • // field of view, aspect ratio, z near, z far
  • // 0-180 w/h
  • glMatrixMode(GL_MODELVIEW)
  • gluLookat(0.0, 0.0, 30.0, / eye /
  • 0.0, 0.0, 0.0, / center /
  • 0.0, 1.0, 0.0) / up /

6
Camera Analogy and Transformations
  • Projection transformations
  • adjust the lens of the camera
  • Viewing transformations
  • tripoddefine position and orientation of the
    viewing volume in the world
  • Modeling transformations
  • moving the model
  • Viewport transformations
  • enlarge or reduce the physical photograph

7
Coordinate Systems and Transformations
  • Steps in Forming an Image
  • specify geometry (world coordinates)
  • specify camera (camera coordinates)
  • project (window coordinates)
  • map to viewport (screen coordinates)
  • Each step uses transformations
  • Every transformation is equivalent to a change in
    coordinate systems (frames)

8
Affine Transformations
  • Want transformations which preserve geometry
  • lines, polygons, quadrics
  • Affine line preserving
  • Rotation, translation, scaling
  • Projection
  • Concatenation (composition)

9
Specifying Transformations
  • Programmer has two styles of specifying
    transformations
  • specify matrices (glLoadMatrix, glMultMatrix)
  • specify operation (glRotate, glOrtho)
  • Programmer does not have to remember the exact
    matrices

10
Programming Transformations
  • Prior to rendering, view, locate, and orient
  • eye/camera position
  • 3D geometry
  • Manage the matrices
  • including matrix stack
  • Combine (composite) transformations

11
Transformation Pipeline
normalized device
eye
object
clip
window
v e r t e x
Modelview Matrix
Projection Matrix
Perspective Division
Viewport Transform
Modelview
Projection
  • other calculations here
  • material è color
  • shade model (flat)
  • polygon rendering mode
  • polygon culling
  • clipping

Modelview
l l l
12
Applying Projection Transformations
  • Typical use (orthographic projection)
  • glMatrixMode( GL_PROJECTION )
  • glLoadIdentity()
  • glOrtho( left, right, bottom, top, zNear, zFar )

13
Viewing Transformations
  • Position the camera/eye in the scene
  • place the tripod down aim camera
  • To fly through a scene
  • change viewing transformation andredraw scene
  • gluLookAt( eyex, eyey, eyez, aimx,
    aimy, aimz, upx, upy, upz )
  • up vector determines unique orientation
  • careful of degenerate positions

14
Projection Tutorial
15
Transformation Tutorial
16
Connection Viewing and Modeling
  • Moving camera is equivalent to moving every
    object in the world towards a stationary camera
  • Viewing transformations are equivalent to several
    modeling transformations
  • gluLookAt() has its own command
  • can make your own polar view or pilot view

17
Projection is left handed
  • Projection transformations (gluPerspective,
    glOrtho) are left handed
  • think of zNear and zFar as distance from view
    point
  • Everything else is right handed, including the
    vertexes to be rendered

y
y
z
left handed
right handed
x
x
z
18
resize() Perspective Translate
  • Same effect as previous LookAt
  • void resize( int w, int h )
  • glViewport( 0, 0, (GLsizei) w, (GLsizei) h )
  • glMatrixMode( GL_PROJECTION )
  • glLoadIdentity()
  • gluPerspective( 65.0, (GLfloat) w/h,
  • 1.0, 100.0 )
  • glMatrixMode( GL_MODELVIEW )
  • glLoadIdentity()
  • glTranslatef( 0.0, 0.0, -5.0 )

19
Hidden Surface Removal
  • Modeling a cube
  • what causes only the 3 front facing sides to be
    visible?
  • Hidden surface removal algorithms
  • object space algorithms
  • image space algorithms
  • z buffer algorithm (requires DEPTH buffer and the
    GL_DEPTH_TEST to be enabled)

20
Hidden Surface Removal
  • Optimize the process by rendering only front
    facing polygons
  • glEnable(GL_CULL_FACE)
  • what is a front facing polygon?
  • One with its normal facing the viewer

21
Homework
  • Begin Presentation.
  • No class Thursday. Go to the library or online.
    Browse Computer Graphics articles. Find a topic
    that interests you. You will need to cite a
    minimum of two sources for your 10 minute
    presentation.
  • Computer Graphics Quarterly - SIGGRAPH
  • Computer Graphics World

22
Program 2 due 3/18
  • Logic
Write a Comment
User Comments (0)
About PowerShow.com