0% found this document useful (0 votes)
381 views

Scan Line Method: Submitted To: Prof. Ratnesh

The document describes the scan line method for hidden surface removal in computer graphics. It discusses that the scan line method processes images one line at a time rather than one pixel at a time. It maintains two tables - an edge table containing edge information and a polygon table containing surface properties. For each scan line, it examines intersecting polygons to determine visibility by comparing depths and enters the nearest surface's intensity value into the frame buffer.

Uploaded by

tanvi garg
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
381 views

Scan Line Method: Submitted To: Prof. Ratnesh

The document describes the scan line method for hidden surface removal in computer graphics. It discusses that the scan line method processes images one line at a time rather than one pixel at a time. It maintains two tables - an edge table containing edge information and a polygon table containing surface properties. For each scan line, it examines intersecting polygons to determine visibility by comparing depths and enters the nearest surface's intensity value into the frame buffer.

Uploaded by

tanvi garg
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

SCAN LINE

METHOD
Submitted to: Prof. Ratnesh

Submitted by:
7/10/2019 Ayush Falor- B027
Tanvi Garg- B028
WHAT IS SCAN LINE?

• Depth Buffer Method

• A s c a n l i n e i n o n e l i n e , o r r o w, i n a
raster scanning pattern such as a
line of video on a cathode ray
tube (CRT) display of a television
s e t o r c o m p u t e r.
WHAT IS SCAN LINE METHOD?

• A scan line method of hidden surface removal is an another approach of image


space method.
• It is an extension of the scan line algorithm for filling polygon interiors.
• Scan line method is a visible surface detection algorithm, It is an image -space
method to identify visible surface .
• It processes one line at a time rather than one pixel at a time. It uses the concept
area of coherence.
• Here, the algorithm deals with more than one surfaces.
• As each scan line is processed, it examines all polygon surfaces intersecting that
line to determine which are visible.
• It then does the depth calculation and finds which polygon is nearest to the view
plane.
• F i n a l l y, i t e n t e r s t h e i n t e n s i t y v a l u e o f t h e n e a r e s t p o l y g o n a t t h a t p o s i t i o n i n t o t h e
f r a m e b u f f e r.
Two important tables, edge table and polygon
table, are maintained for this.

• T h e E d g e Ta b l e − I t c o n t a i n s
• coordinate endpoints of each line in the
scene,
• the inverse slope of each line, and
• pointers into the polygon table to
connect edges to surfaces.
• The P o l y g o n Ta b l e − I t c o n t a i n s
• the plane coefficients,
• surface material properties,
• other surface data, and
• may be pointers to the edge table.
Scan line method

The scan line algorithm maintains the edge list in the edge table(ET). The
AET(Active Edge Table) contains only edges that cross the current scan
Line, sorted in order of increasing x. The scan line method of hidden
surface removal also stores a flag for each surface that is set on or off to
indicate whether a position along a scan line is inside or outside of the
surface. Scan lines are processed from left to right. At the leftmost
boundary of a surface, the surface flag is turned ON; and at the rightmost
boundary, it is turned OFF.
The figure (f) illustrates the scan line method for hidden surface removal.
As shown in the Fig. (f), the active edge list for scan line 1 contains the
information for edges AD, BC, EH and FG. for the positions along this
scan line between edges AD and BC, only the flag for surface S1 is ON.
Therefore, no depth calculations are necessary, and intensity information
for surface S1 is entered into the frame buffer. Similarly, between edges
EH and FG, only the flag for surface S2 is ON and during that portion of
scan line the intensity information for surface S2, is entered into the
frame buffer.
For scan line 2 in the figure (f), the active edge list contains edges AD,
EH, BC and FG. Along the scan line 2 from edge AD to edge EH, only
the flag for surfaces S1 is ON. However, between edges EH and BC, the
flags for both surfaces are ON. In this portion of scan line 2, the depth
calculations are necessary. Here we have assumed that the depth of S1
is less than the depth of S2 and hence the intensities of surface S1 are
loaded into the frame buffer. Then, for edge BC to edge FG portion of
scan line 2 intensities of surface S2 are entered into the frame buffer
because during that portion only flag for S2 is ON.

To implement this algorithm along with AET we are required to maintain


a polygon table (PT) that contains at least the following information for
each polygon, in addition to ID.
The coefficient of the plane equation.
Shading or colour information for the polygon.
A in-out Boolean flag, initialized to false and used during scan line
processing.
Fig. (g) Shows the ET, PT and AET for the scan line algorithm.
WHY USE SCANLINE?

• Scan line fill algorithm is defined at geometric level


i.e. coordinates, edges, vertices etc.
• The algorithm starts with first scan line and
proceeds line by line to the last scan line.
• It checks whether every pixel on that scan line
satisfies inside point test or not i.e. it checks which
points on that scan line are inside the polygon.
• This method avoids the need for seed point.

7
ALGORITHM:
COMPONENTS OF ALGORITHM

• Edge Buckets: It contains an edge’s information. The entries


of edge bucket vary according to data structure you have
used.In the example we are taking below, there are three
edge buckets namely: ymax, xofymin,slopeinverse.
• Edge Table: It consists of several edge lists -> holds all of
the edges that compose the figure. When creating edges,
the vertices of the edge need to be ordered from left to right
and thee edges are maintained in increasing yMin order.
Filling is complete once all of the edges are removed from
the ET
• Active List: IT maintains the current edges being used to fill
in the polygon.Edges are pushed into the AL from the Edge
Table when an edge’s yMin is equal to the current scan line
being processed. The Active List will be re-sorted after every
pass.

8
STEPS:

Step1: Start algorithm


Step2: Initialize the desired data structure
• Create a polygon table having color, edge pointers, coefficients
• Establish edge table contains information regarding, the endpoint of edges, pointer to polygon, inverse slope.
• Create Active edge list. This will be sorted in increasing order of x.
• Create a flag F. It will have two values either on or off.
Step3: Perform the following steps for all scan lines
• Enter values in Active edge list (AEL) in sorted order using y as value
• Scan until the flag, i.e. F is on using a background color
• When one polygon flag is on, and this is for surface S1enter color intensity as I1into refresh buffer
• When two or image surface flag are on, sort the surfaces according to depth and use intensity value Sn for the nth surface. This surface will
have least z depth value
• Use the concept of coherence for remaining planes.
Step4: Stop Algorithm

9
ADVANTAGES AND DISADVANTAGES

• The advantages of Scan line algorithm are as follows


• It takes advantage of coherence resulting in fast algorithm.
• It does require as much storage as depth buffer
• It only draws visible pixels.
• This algorithm is common in software.
• The disadvantages of Scan line algorithm are as follows
• It is a more complex algorithm.
• It requires all polygons sent to renderer before drawing.

Logo here 10
THANK YOU!

You might also like