Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Computer Graphics
ITGD3107
Presentation name :
Dr. Sana'a
p_16_10 @hotmail.com it4ever2008 @hotmail.com 1
Contents 3D Viewing Camera Analogy Viewing Pipeline Camera Modeling w/ OpenGL Projections Types of Projections Perspective Projection Parallel Projection Projection Matrix Projection of Lines 3D Viewing with OpenGL Matrix Modes Three Dimensional Viewing
p_16_10 @hotmail.com it4ever2008 @hotmail.com
3D Viewing
The steps for computer generation of a view of a three dimensional scene are somewhat analogous to the processes involved in taking a photograph.
Camera Analogy
1. 2. 3.
Orientation
Viewing Pipeline
The general processing steps for modeling and converting a world coordinate description of a scene to device coordinates:
Viewing Pipeline
1.
Construct the shape of individual objects in a scene within modeling coordinate, and place the objects into appropriate positions within the scene (world coordinate).
Viewing Pipeline
World coordinate positions are converted to viewing coordinates.
Viewing Pipeline
Convert the viewing coordinate description of the scene to coordinate positions on the projection plane.
Viewing Pipeline
Positions on the projection plane, will then mapped to the Normalized coordinate and output device.
glMatrixMode(GL_MODELVIEW) ...
glViewport(0,0,xres,yres)
glMatrixMode(GL_PROJECTION) ...
p_16_10 @hotmail.com it4ever2008 @hotmail.com 10
Projections
Once the view volume is determined, a projection transformation will convert the object in the 3D view volume to a 2D image on the projection plane.
11
Types of Projections
Perspective Projection
Parallel Projection
12
Give a realistic view of 3D objects, but does not preserve shape of object or scale Perspective images of parallel lines not parallel with projection plane converge to a point called vanishing point Size of object is diminished with distance Used in architectural, engineering, industrial design, and advertising drawings
p_16_10 @hotmail.com it4ever2008 @hotmail.com
13
1-point perspective
Most popular
2-point perspective
p_16_10 @hotmail.com it4ever2008 @hotmail.com
3-point perspective
14
Parallel Projection
Accurate and same-scale measurements Not realistic, and may require multiple projections to get a complete feeling of the object Used in drawings of machine parts and in working architectural drawings
15
Isometric
Multi-view orthographic
cavalier
cabinet
p_16_10 @hotmail.com it4ever2008 @hotmail.com
Oblique
16
xp yp d 1
= Mper/ort
x y z 1
COP
d 1 0 0 0 0 0 1 0 0 1 0 1/d
z
0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 d 1
17
Mper =
Mort =
p_16_10 @hotmail.com it4ever2008 @hotmail.com
xp yp 0 1
= Mper/ort
x y z 1
Mper =
Mort =
p_16_10 @hotmail.com it4ever2008 @hotmail.com
Mgeneral =
1 0 0 0
0 1 0 0
d (a, b, c)
z
p_16_10 @hotmail.com it4ever2008 @hotmail.com 19
Projection of Lines
y x
Parametric representation of a line that goes through P(px, py, pz) and has direction c = (cx, cy, cz) l(t) = P+ct where t (-, + ) The projected line is
COP d
x(t) = d(px+cxt)/(pz+czt)
y(t) = d(py+cyt)/(pz+czt)
If the original line is parallel to the projection plane (cz = 0) x(t) = d(px+cxt)/pz, y(t) = d(py+cyt)/pz, the slope of the projected line is cy/cx, independent of the position of the original line. The projected lines of parallel lines must be parallel
p_16_10 @hotmail.com it4ever2008 @hotmail.com
20
Viewing transformation: set the position and orientation of the viewpoint Modeling transformation: set the orientation of the model (translate, rotate, scale) Projection transformation: set the view volume and do the projection Viewport transformation: Set the viewport on the computer screen where the scene will be drawn
21
Matrix Modes
Modelview matrix Set the viewpoint and object location by modifying this matrix glMatrixMode(GL_MODELVIEW)
If projection matrix is modified Specify the view volume by modifying this matrix glMatrixMode(GL_PROJECTION) If texture matrix is modified glMatrixMode(GL_TEXTURE)
p_16_10 @hotmail.com it4ever2008 @hotmail.com 22
23