DMIoT School of Computing Software Engineering Academic Program
CHAPTER SIX
6. PROJECTION
6.1. Introduction
So far most of the concepts we have discussed in this course have been equally applicable
to 2-D and 3-D graphics. However, most graphics is performed in 3-D and there are some
specific issues that only arise when dealing with 3-D graphics. This chapter highlights
some of the issues of projection.
6.2. Projections
Projection is the process of transforming 3D coordinates of shapes to points on the
viewing plane. Viewing plane is the 2D flat surface that represents an embedding of an
image into the 3D space. We know that projections are used to convert 3-D object
coordinates into 2-D image coordinates.
In projection, we represent a 3D object on a 2D plane. When geometric objects are
formed by the intersection of lines with a plane, the plane is called projection plane and
the lines are called projectors. Projection of 3D object is defined by straight projection
rays (projectors) emanating from the center of projection (COP) passing through each
point of the object and intersecting the projection plane.
Projection is the process of transforming 3D coordinates onto a 2D image plane. 2D
projected images are formed by the intersection of projectors with projection plane.
Projectors are lines from an arbitrary point (centre of projection) passes through each
point in an object. Center of projection is an arbitrary point from where the lines are
drawn on each point of an object.
There are two basic types of projection:
6.2.1. Parallel projection
All projection lines are parallel, and objects that are further away do not appear smaller
on the image plane. In parallel projection, an object is projected onto an imaginary 2D
plane along lines which are parallel to each other. Parallel projection discards z-
coordinate and parallel lines from each vertex on the object are extended until they
Computer graphics (SEng 4103) 1
DMIoT School of Computing Software Engineering Academic Program
intersect the view plane. In parallel projection, we specify a direction of projection
instead of center of projection.
In parallel projection, the distance from the center of projection to project plane is
infinite. In this type of projection, we connect the projected vertices by line segments
which correspond to connections on the original object.
Parallel projections are less realistic, but they are good for exact measurements. Parallel
projections gives better views of the various sides of an object (front view, top view,
side views). In this type of projections, parallel lines remain parallel and angles are not
preserved.
Parallel projection is divided into the following types:
Orthographic projection
Oblique projection
Various types of parallel projections are shown in the following hierarchy.
Orthographic Projection
In orthographic projection the direction of projection is normal to the projection of the
plane. Orthographic projection occurs when the direction of projection is perpendicular
to the plane of projection. There are three types of orthographic projections −
Front Projection
Top Projection
Side Projection
Computer graphics (SEng 4103) 2
DMIoT School of Computing Software Engineering Academic Program
The orthographic views, center of projection and projection plane are shown in the following table.
Orthographic projections that show more than one side of an object are
called axonometric orthographic projections. The projection plane is aligned so that it
intersects each coordinate axes in which the object is defined (principal axes) at the same
distance from the origin. All the three principal axes are foreshortened (projected)
equally. The most common axonometric projection is an isometric projection where the
projection plane intersects each coordinate axis in the model coordinate system at an
equal distance. In this projection parallelism of lines are preserved but angles are not
preserved. The following figure shows isometric projection.
Oblique Projection
In oblique projection, the direction of projection is not normal to the projection of plane.
In oblique projection, the lines of projections are making an angle other than 900 with
the projection plane. In oblique projection, we can view the object better than
orthographic projection. Oblique projection occurs when the angle between the
projectors and the plane of projection is not equal to 900.
There are two types of oblique projections − Cavalier and Cabinet. The Cavalier
projection makes 45° angle with the projection plane. The projection of a line
perpendicular to the view plane has the same length as the line itself in Cavalier
projection. In a cavalier projection, the foreshortening factors for all three principal
directions are equal.
The Cabinet projection makes 63.4° angle with the projection plane. In Cabinet
projection, lines perpendicular to the viewing surface are projected at ½ their actual
length. Both the projections are shown in the following figure.
Computer graphics (SEng 4103) 3
DMIoT School of Computing Software Engineering Academic Program
6.2.2. Perspective projection
All projection lines converge to a point, and objects that are further away from the
camera appear smaller on the image plane. In perspective projection, an object is
projected along lines which converge to a point called center of projection.
In perspective projection, the distance from the center of projection to project plane is
finite and the size of the object varies inversely with distance which looks more realistic.
Projections of distant objects are smaller than the projections of objects of the same size
that are closer to the projection plane.
The distance and angles are not preserved and parallel lines do not remain parallel.
Instead, they all converge at a single point called center of projection or projection
reference point. In perspective projection, angles between lines are not preserved unless
lines are parallel to the view plane.
There are 3 types of perspective projections which are shown in the following chart.
One point perspective projection
A drawing has one-point perspective when it contains only one vanishing point on the
horizon line. This type of perspective is typically used for images of roads, railway
tracks, hallways, or buildings viewed so that the front is directly facing the viewer. Any
objects that are made up of lines either directly parallel with the viewer's line of sight or
directly perpendicular (the railroad slats) can be represented with one-point perspective.
Computer graphics (SEng 4103) 4
DMIoT School of Computing Software Engineering Academic Program
These parallel lines converge at the vanishing point. In one point perspective projection,
the projection plane is perpendicular to one of the principal axes.
One-point perspective exists when the picture plane is parallel to two axes of a rectilinear
(or Cartesian) scene—a scene which is composed entirely of linear elements that intersect
only at right angles. If one axis is parallel with the picture plane, then all elements are
either parallel to the picture plane (either horizontally or vertically) or perpendicular to it.
All elements that are parallel to the picture plane are drawn as parallel lines. All elements
that are perpendicular to the picture plane converge at a single point (a vanishing point)
on the horizon.
Two point perspective projection
A drawing has two-point perspective when it contains two vanishing points on the
horizon line. In an illustration, these vanishing points can be placed arbitrarily along the
horizon. Two-point perspective can be used to draw the same objects as one-point
perspective, rotated: looking at the corner of a house, or at two forked roads shrinking
into the distance, for example. One point represents one set of parallel lines, the other
point represents the other. Seen from the corner, one wall of a house would recede
towards one vanishing point while the other wall recedes towards the opposite vanishing
point. The projection plane intersects two principal axis (or it will be parallel to one of
the principal axis) in two point perspective projection.
Two-point perspective exists when the painting plate is parallel to a Cartesian scene in
one axis (usually the z-axis) but not to the other two axes. If the scene being viewed
consists solely of a cylinder sitting on a horizontal plane, no difference exists in the
image of the cylinder between a one-point and two-point perspective.
Two-point perspective has one set of lines parallel to the picture plane and two sets
oblique to it. Parallel lines oblique to the picture plane converge to a vanishing point,
which means that this set-up will require two vanishing points.
A cube drawn using two point perspective.
Computer graphics (SEng 4103) 5
DMIoT School of Computing Software Engineering Academic Program
Three point perspective projection
Three-point perspective is often used for buildings seen from above (or below). In
addition to the two vanishing points from before, one for each wall, there is now one for
how the vertical lines of the walls recede. For an object seen from above, this third
vanishing point is below the ground. For an object seen from below, as when the viewer
looks up at a tall building, the third vanishing point is high in space.
Three-point perspective exists when the perspective is a view of a Cartesian scene where
the picture plane is not parallel to any of the scene's three axes. Each of the three
vanishing points corresponds with one of the three axes of the scene. One, two and three-
point perspectives appear to embody different forms of calculated perspective, and are
generated by different methods. Mathematically, however, all three are identical; the
difference is merely in the relative orientation of the rectilinear scene to the viewer.
Three point perspective
By varying the position of projection reference point and the projection plane, we have
different standard cases of perspective projection.
Case 1:
If p(x, y, z) is any point and cp(xc, yc, zc) is the centre of projection, p’(xp, yp, zp) is the
perspective projection of p on z = 0 plane with reference to cp, we can find the projection
coordinate P’(Xp, Yp, Zp) on the line PCp.
Computer graphics (SEng 4103) 6
DMIoT School of Computing Software Engineering Academic Program
Assume that Cp is on the negative z-axis at a distance d from the origin, then:
Putting zc = -d
Computer graphics (SEng 4103) 7
DMIoT School of Computing Software Engineering Academic Program
So the transformation equation involved when the point p (x, y, z) is projected on the z = 0
plane with cp on the z – axis is given by:
Here h is the homogenous factor and is equal to z +d, then
Case 2:
The perspective projection point p’(xp, yp, zp) of any point p(x, y ,z) is onto the z = k
plane from the centre of projection cp(0, 0, -d) on the line pcp is given by:
When zp = k
Computer graphics (SEng 4103) 8
DMIoT School of Computing Software Engineering Academic Program
The transformation matrix can be found by:
Computer graphics (SEng 4103) 9
DMIoT School of Computing Software Engineering Academic Program
Example: A cube has its vertices located at A(0,0,10), B(10,0,10),C(10,10,10),
D(0,10,10), E(0,0,0), F(10,0,0), G(10,10,0) & H(0,10,0).
The y-axis is vertical and z-axis is oriented towards the viewer. If the cube is being
viewed from the point (0, 20, 80), find out the perspective view of the cube on the xy-
plane.
Solution:
xy plane – plane of projection
(0, 20, 80) – Centre of projection
(x, y, z) – coordinates of a point before projection
Let (xp, yp, zp) be coordinates of a projected point.
xp = x + (0 – x)t
yp = y + (20 – y)t
zp = z + (80 – z)t
Since xy plane is plane of projection, zp = 0, then
zp = z + (80 – z)t
z + (80 – z)t = 0
(80 – z)t = -z
t = -z/(80-z)
t = z/(z-80)
xp = x + (0 – x)t
= x – x(z/(z-80))
= (x(z – 80) – xz)/(z – 80)
= (xz – 80x – xz)/(z – 80)
= -80x/(z -80)
Computer graphics (SEng 4103) 10
DMIoT School of Computing Software Engineering Academic Program
yp = y + (20 – y)t
= y +(20 – y) z/(z-80)
= (y(z – 80) + 20z - yz)/(z – 80)
= (yz – 80y +20z - yz)/(z – 80)
= (– 80y+ 20z)/(z -80)
xp = xh/h = -80x/(z-80),
yp = yh/h = (– 80y+ 20z)/(z -80),
zp = 0, where h = z – 80
A’(0,-20/7,0), B’(80/7,-20/7,0), C’(80/7,60/7,0), D’(0,60/7,0), E’(0,0,0), F’(10,0,0),
G’(10,10,0) & H’(0,10,0)
A short summary of parallel and perspective projection is presented in the following
table.
Parallel projection Perspective projection
Lines of projection are parallel to each Lines of projection converge at a point called
other center of projection
Suitable for generating FRONT, TOP, Suitable for generating perspective views of a 3D
SIDE views of a 3D scene. scene.
Orthographic projection is the default One point perspective the default projection.
projection.
Preserve realistic proportions of the sides Don’t preserve relative proportions of the sides of
of an object. an object.
The center of projection is at infinite. Center of projection is chosen to be a finite point.
Views are less realistic. Views are more realistic.
6.3. OpenGL 3-D Object Functions
The OpenGL library on its own does not provide any routines for drawing 3-D objects –
it provides routines for drawing basic primitives such as polygons only and relies on the
programmer to construct 3-D objects in the form of polygonal meshes. However, the glut
library does provide a number of routines for displaying a range of pre-defined 3-D
Computer graphics (SEng 4103) 11
DMIoT School of Computing Software Engineering Academic Program
objects. We can divide these routines into those that draw regular polyhedra and those
that draw quadric or cubic surfaces.
Regular Polyhedra
A regular polyhedron is defined as a polyhedron in which all of the faces are regular
polygons. A regular polygon is one in which all sides and angles are equal. Regular
polyhedra are also called Platonic solids, and there are five in all: the cube, tetrahedron,
octahedron, dodecahedron and icosahedron. All can be drawn in either wireframe or solid
using glut routines, as summarised in the table below.
Polyhedron Routine for Wireframe Rendering Routine for Solid Rendering
Cube glutWireCube(GLdouble size) glutSolidCube(GLdouble size)
Tetrahedron glutWireTetrahedron() glutSolidTetrahedron()
Octahedron glutWireOctahedron() glutSolidOctahedron()
Dodecahedron glutWireDodecahedron() glutSolidDodecahedron()
Icosahedron glutWireIcosahedron() glutSolidIcosahedron()
Quadric/Cubic Surfaces
A quadric surface is one that can be defined by 2nd order equations, whilst a cubic surface
can be defined by a 3rd order equation. The glut library provides routines for drawing a
number of quadric/cubic surfaces, although we should remember that actually it will
create an approximation of the surface using a polygonal mesh.
Object Routine for Wireframe Rendering Routine for Solid Rendering
Sphere glutWireSphere(GLdouble radius, glutSolidSphere(GLdouble radius,
GLint nSlices, GLint nStacks) GLint nSlices, GLint nStacks)
Torus glutWireTorus(GLdouble inRad, glutSolidTorus(GLdouble inRad,
GLdouble outRad, GLint nSlices, GLdouble outRad, GLint nSlices,
GLint nStacks) GLint nStacks)
Cone glutWireCone(GLdouble baseRad, glutSolidCone(GLdouble baseRad,
GLdouble height, GLint nSlices, GLdouble height, GLint nSlices,
GLint nStacks) GLint nStacks)
Teapot glutWireTeapot(GLdouble size) glutSolidTeapot(GLdouble size)
Computer graphics (SEng 4103) 12