Professional Documents
Culture Documents
Pipeline
Pipeline
3D Polygon Rendering
Many applications use rendering of 3D polygons with direct illumination
3D Polygon Rendering
Many applications use rendering of 3D polygons with direct illumination
Quake II
(Id Software)
3D Polygon Rendering
Many applications use rendering of 3D polygons with direct illumination
Construct ray from eye position through view plane Find first surface intersected by ray through pixel Compute color of sample based on surface radiance
3D Polygon Rendering
What steps are necessary to utilize spatial coherence while drawing these polygons into a 2D image?
Example: OpenGL
Modeling Modeling Transformation Transformation Lighting Lighting Viewing Viewing Transformation Transformation Projection Projection Transformation Transformation Clipping Clipping Scan Scan Conversion Conversion Image
glBegin(GL_POLYGON); glVertex3f(0.0, 0.0, glVertex3f(0.0, 0.0, glVertex3f(0.0, 0.0, glVertex3f(0.0, 0.0, glEnd();
Transform into 3D world coordinate system Illuminate according to lighting and reflectance
Transform into 3D world coordinate system Illuminate according to lighting and reflectance Transform into 3D camera coordinate system
Transform into 3D world coordinate system Illuminate according to lighting and reflectance Transform into 3D camera coordinate system Transform into 2D camera coordinate system
Transform into 3D world coordinate system Illuminate according to lighting and reflectance Transform into 3D camera coordinate system Transform into 2D camera coordinate system Clip primitives outside cameras view
Transform into 3D world coordinate system Illuminate according to lighting and reflectance Transform into 3D camera coordinate system Transform into 2D camera coordinate system Clip primitives outside cameras view Draw pixels (includes texturing, hidden surface, etc.)
Transformations
3D Geometric Primitives Modeling Modeling Transformation Transformation Lighting Lighting Viewing Viewing Transformation Transformation Projection Projection Transformation Transformation Clipping Clipping Scan Scan Conversion Conversion Image
Transform into 3D world coordinate system Illuminate according to lighting and reflectance Transform into 3D camera coordinate system Transform into 2D camera coordinate system Clip primitives outside cameras view Draw pixels (includes texturing, hidden surface, etc.)
Transformations
p(x,y,z)
3D Object Coordinates Modeling Modeling Transformation Transformation 3D World Coordinates Viewing Viewing Transformation Transformation
3D Camera Coordinates
2D Screen Coordinates Window-to-Viewport Window-to-Viewport Transformation Transformation 2D Image Coordinates 3D World Coordinates
p(x,y)
Viewing Transformations
p(x,y,z)
3D Object Coordinates Modeling Modeling Transformation Transformation 3D World Coordinates Viewing Viewing Transformation Transformation 3D Camera Coordinates Projection Projection Transformation Transformation 2D Screen Coordinates Window-to-Viewport Window-to-Viewport Transformation Transformation 2D Image Coordinates
Viewing Transformations
p(x,y)
Viewing Transformation
Mapping from world to camera coordinates
Origin moves to eye position Up vector maps to Y axis Right vector maps to X axis back right
View plane
up
Camera
y x World
Camera Coordinates
Canonical coordinate system
Convention is right-handed (looking down -z axis) Convenient for projection, clipping, etc. y
Camera up vector maps to Y axis
Viewing Transformation
Transformation matrix maps camera basis vectors to canonical vectors in camera coordinate system
Back
Up Eye
Rx U x R U y M = y Rz U z Rw U w
Bx By Bz Bw
Ex Ey Ez Ew
(0,1,0)
(1,0,0) (0,0,1)
Right
10
Viewing Transformations
p(x,y,z)
3D Object Coordinates Modeling Modeling Transformation Transformation 3D World Coordinates Viewing Viewing Transformation Transformation 3D Camera Coordinates Projection Projection Transformation Transformation 2D Screen Coordinates Window-to-Viewport Window-to-Viewport Transformation Transformation 2D Image Coordinates
Viewing Transformations
p(x,y)
Projection
General definition:
Transform points in n-space to m-space (m<n) Map 3D camera coordinates to 2D screen coordinates
In computer graphics:
11
Taxonomy of Projections
Taxonomy of Projections
12
Parallel Projection
Center of projection is at infinity
Orthographic Projections
DOP perpendicular to view plane
Front
Top
Side
13
Oblique Projections
DOP not perpendicular to view plane
Cavalier o (DOP at 45 )
14
x s 1 y s 0 z = 0 s ws 0
0 L1 cos 1 L1 sin 0 0 0 0
0 xc 0 yc 0 zc 1 1
Taxonomy of Projections
15
Perspective Projection
Map points onto view plane along projectors emanating from center of projection (COP)
Pr oj ec to rs
Center of Projection
View Plane
Perspective Projection
How many vanishing points?
3-Point Perspective
2-Point Perspective
1-Point Perspective
16
View Plane
Perspective Projection
Compute 2D coordinates from 3D coordinates with similar triangles
(x,y,z)
-z y
-z D
(0,0,0) z
What are the coordinates of the point resulting from projection of (x,y,z) onto the view plane?
View Plane -y
17
Perspective Projection
Compute 2D coordinates from 3D coordinates with similar triangles
(x,y,z)
-z y
-z D
(0,0,0) z
(xD/z, yD/z)
View Plane -y
xs = xc D / zc y s = yc D / z c zs = D ws = 1
xs ? ys ? z = ? s ? ws
? ? ? ?
? ? ? ?
? xc ? yc ? z c ? 1
18
xs = xc D / zc y s = yc D / z c zs = D ws = 1
x= xc y = yc z = zc w= zc / D
? ? ? ? ? ? ? ? ? xc ? yc ? z c ? 1
xs ? ys ? z = ? s ? ws
xs = xc D / zc y s = yc D / z c zs = D ws = 1
x= xc y = yc z = zc w= zc / D
0 0 1 0 0 1 0 1/ D 0 xc 0 yc 0 z c 0 1
x s 1 y s 0 z = 0 s 0 ws
19
Taxonomy of Projections
Parallel projection
+ + Good for exact measurements Parallel lines remain parallel Angles are not (in general) preserved Less realistic looking
20
Classical Projections
Summary
Camera transformation
Map 3D world coordinates to 3D camera coordinates Matrix has camera vectors as rows
Projection transformation
Map 3D camera coordinates to 2D screen coordinates Two types of projections: Parallel Perspective
21
Next Time
3D Geometric Primitives Modeling Modeling Transformation Transformation Lighting Lighting Viewing Viewing Transformation Transformation Projection Projection Transformation Transformation Clipping Clipping Scan Scan Conversion Conversion Image
Transform into 3D world coordinate system Illuminate according to lighting and reflectance Transform into 3D camera coordinate system Transform into 2D camera coordinate system Clip primitives outside cameras view Draw pixels (includes texturing, hidden surface, etc.)
22