6. 3D Perspective

Brock University
COSC 3P98 Computer Graphics
Instructor: Brian Ross



Viewing 3D graphics: Terms

world coordinates: coordinate system used by application model
 
world coordinate window: area of world coordinates to draw
 
screen (device) coordinates: pixel coordinates used by terminal, plotter, ...
 
viewport: area of graphics window to map world coordinate window into
clipping: drawing images that reside within viewport, and ignoring images outside the viewport


Viewing 3D


Viewing 3D

  1. clip objects in a 3D viewing volume
  2. project viewing volume onto a viewing plane (world coord. window)
  3. transform plane to viewport
  4. draw viewport on graphics window


Main types of planar projections:


Parallel projections

(x, y, z) --> drop z coordinate --> (x, y) : projects onto x-y plane


Parallel projection


Parallel projection: OpenGL

glOrtho(GLdouble Xmin, Xmax, Ymin, Ymax, Zmin, Zmax)


Perspective projection


Perspective

y'/d = y/z 

or

y' = d*y/z = y*(d/z)
t = d/z <-- perspective factor: multiply it to y's, x's

So... y'= y*t = y*(d/z),   x' = x*t = x*(d/z)

                         | 1 0  0  0 |
            Mper    =    | 0 1  0  0 |
			 | 0 0  1  0 |
			 | 0 0 1/d 0 |

ie. P' = Mper * P = (x*(d/z), y*(d/z), d)    (d = posn of proj plane on z axis)

 


Perspective


Projection example

 Point

World coords

Orthographic coords

Perspective factor t

Perspective coords

A

 (2,1,-1)

 (2,1)

 1.0

 (2,1)

 B

 (2,1,-10)

 (2,1)

 0.1

 (0.2, 0.1)

 C

 (2,1,-100)

 (2,1)

 0.01

 (0.02, 0.01)

 D

 (2,-5,-100)

 (2,-5)

 0.01

 (0.02, -0.05)

 E

 (-50,-50,-100)

 (-50,-50)

 0.01

 (-0.5, -0.5)


References



Back to COSC 3P98 index

COSC 3P98 Computer Graphics
Brock University
Dept of Computer Science
Copyright © 2023 Brian J. Ross (Except noted figures).
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/3d_perspective/
Last updated: March 9, 2023