You are on page 1of 44

AMAL JYOTHI COLLEGE OF ENGINEERING

KANJIRAPPALLY

COMPUTER GRAPHICS

Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally


Projections – Parallel and perspective projections – vanishing
points.
Visible surface detection methods– Back face removal- Z-
Buffer algorithm, Depth-sorting method, Scan line algorithm.

2
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Projections

It is the process of converting a 3D object into a 2D object. It is also defined as


mapping or transformation of the object in projection plane or view plane.

The view plane is displayed surface.

There are two graphical projection categories,

❑ Parallel projection
❑ Perspective projection

3
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Parallel projection

A parallel projection is a
projection of an object in
three-dimensional space onto a
fixed plane, known as the
projection plane or image
plane, where the rays, known
as lines of sight or projection
lines, are parallel to each other.

4
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Orthographic Projection
In orthographic projection the direction of projection is normal to the
projection of the plane. There are three types of orthographic projections −
•Front Projection
•Top Projection
•Side Projection

5
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Oblique Projection

In oblique projection, the direction of projection is not normal to the projection of


plane.
In oblique projection, we can view the object better than orthographic projection.
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.
6
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
7
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
8
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Isometric Projections

Orthographic projections that show more than one side of an object are
called axonometric orthographic projections.

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.

9
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Perspective Projection

In perspective projection farther away object from the viewer, small it


appears. This property of projection gives an idea about depth. The artist use
perspective projection from drawing three-dimensional scenes.
Two main characteristics of perspective are
vanishing points and perspective
foreshortening. Due to foreshortening
object and lengths appear smaller from the
center of projection. More we increase the
distance from the center of projection,
smaller will be the object appear.
10
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
11
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Vanishing Point

It is the point where all lines will appear to meet. There can be one
point, two point, and three point perspectives.

12
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
13
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
One Point: There is only one vanishing point

14
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Two Points: There are two vanishing points. One is the x-direction and
other in the y -direction

15
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Three Points: There are three vanishing points. One is x second in y
and third in two directions.

16
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Parallel Projection Perspective Projection
Parallel projection represents the Perspective projection represents
1
object in a different way like telescope. the object in three dimensional way.
The distance of the object from the The distance of the object from the
2
center of projection is infinite. center of projection is finite.
Parallel projection can give the accurate Perspective projection cannot give
3
view of object. the accurate view of object.
The lines of parallel projection are The lines of perspective projection
4
parallel. are not parallel.
Three types of perspective
Two types of parallel projection : projection:
5 1.Orthographic, 1.one point perspective,
2.Oblique 2.Two point perspective,
3. Three point perspective,
6 It does not form realistic view of object. It forms a realistic view of object.

17
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Visible surface detection methods

18
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
When we view a picture containing non-transparent objects and
surfaces, then we cannot see those objects from view which are
behind from objects closer to eye.
We must remove these hidden surfaces to get a realistic screen
image. The identification and removal of these surfaces is
called Hidden-surface problem.

19
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Classification of Visible-Surface Detection Algorithms:

There are two approaches for removing hidden surface problems


− Object-Space method and Image-space method.

The Object-space method is implemented in physical coordinate


system and image-space method is implemented in screen
coordinate system.

20
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
1. Object-space Methods

Compare objects and parts of objects to each other within the scene
definition to determine which surfaces, as a whole, we should label as
visible:

❑ Compare each object with all other objects to determine the visibility of
the object parts.
❑If there are n objects in the scene, complexity = O(n2 )

21
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
❑ Calculations are performed at the resolution in which the objects are
defined
❑ Display is more accurate but computationally more expensive as
compared to image space methods because step 1 is typically more
complex, eg. Due to the possibility of intersection between surfaces. –
❑ Suitable for scene with small number of objects and objects with simple
relationship with each other.

22
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Image-space Methods (Mostly used)

Visibility is determined point by point at each pixel position on the projection


plane.
- For each pixel, examine all n objects to determine the one closest to the
viewer.
- If there are p pixels in the image, complexity depends on n and p ( O(np) ).
- Accuracy of the calculation is bounded by the display resolution.
- A change of display resolution requires re-calculation.

23
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Back-Face Detection

When we project 3-D objects on a 2-D screen, we need to detect the faces
that are hidden on 2D.
Back-Face detection, also known as Plane Equation method, is an
object space method in which objects and parts of objects are compared
to find out the visible surfaces.

27
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
In a solid object, there are surfaces which are facing the viewer (front faces)
and there are surfaces which are opposite to the viewer (back faces).

These back faces contribute to


approximately half of the total
number of surfaces. Since we
cannot see these surfaces anyway,
to save processing time, we can
remove them before the clipping
process with a simple test.

28
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
29
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
30
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
31
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Depth-Buffer Method

This approach compares surface depths at each pixel position on the


projection plane.
Object depth is usually measured from the view plane along the z axis of a
viewing system.
This method requires 2 buffers: one is the image buffer and the other is
called the z-buffer (or the depth buffer).
Each of these buffers has the same resolution as the image to be captured.
As surfaces are processed, the image buffer is used to store the color values
of each pixel position and the z-buffer is used to store the depth values for
each (x,y) position.

32
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
33
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
34
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
35
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
36
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
37
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
38
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
39
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
40
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
Advantages
•It is easy to implement.
•It reduces the speed problem if implemented in hardware.
•It processes one object at a time.

Disadvantages
•It requires large memory.
•It is time consuming process.

Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally


Uses

The Z-buffer is a technology used in almost all contemporary computers,


laptops and mobile phones for performing 3D graphics, for example for
computer games.

Furthermore, Z-buffer data obtained from rendering a surface from a


light's point of view permits the creation of shadows by the shadow
mapping technique

Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally


43
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
44
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
45
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
46
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally
To facilitate the search for surfaces crossing a given scan-line, an active list of
edges is formed.
The active list stores only those edges that cross the scan-line in order of
increasing x.
Also a flag is set for each surface to indicate whether a position along a scan-line
is either inside or outside the surface.
Pixel positions across each scan-line are processed from left to right.
At the left intersection with a surface, the surface flag is turned on and at the right,
the flag is turned off.
You only need to perform depth calculations when multiple surfaces have their
flags turned on at a certain scan-line position.

47
Department of Computer Science, Amaljyothi College of Engineering, Kanjirapally

You might also like