Saturday, 15 October 2011

Scan Line Method of Computer Graphics

Scan Line Method of Computer Graphics

Scanline rendering is an algorithm for visible surface determination, in 3D computer graphics, that works on a row-by-row basis rather than a polygon-by-polygon or pixel-by-pixel basis. All of the polygons to be rendered are first sorted by the top y coordinate at which they first appear, then each row or scan line of the image is computed using the intersection of a scan line with the polygons on the front of the sorted list, while the sorted list is updated to discard no-longer-visible polygons as the active scan line is advanced down the picture.
The main advantage of this method is that sorting vertices along the normal of the scanning plane reduces the number of comparisons between edges. Another advantage is that it is not necessary to translate the coordinates of all vertices from the main memory into the working memory—only vertices defining edges that intersect the current scan line need to be in active memory, and each vertex is read in only once. The main memory is often very slow compared to the link between the central processing unit and cache memory, and thus avoiding re-accessing vertices in main memory can provide a substantial speedup.

 Algo :

 The usual method starts with edges of projected polygons inserted into buckets, one per scanline; the rasterizer maintains an active edge table(AET). Entries maintain sort links, X coordinates, gradients, and references to the polygons they bound. To rasterize the next scanline, the edges no longer relevant are removed; new edges from the current scanlines' Y-bucket are added, inserted sorted by X coordinate. The active edge table entries have X and other parameter information incremented. Active edge table entries are maintained in an X-sorted list by bubble sort, effecting a change when 2 edges cross. After updating edges, the active edge table is traversed in X order to emit only the visible spans, maintaining a Z-sorted active Span table, inserting and deleting the surfaces when edges are crossed.

Depth Buffer Method of Computer Graphics

-Buffer Algorithm
List of polygons {P1, P2, ..., Pn }
An array z-buffer[x,y] initialized to −∞
An array Intensity[x,y]
for each polygon P in the polygon list do {
for each pixel (x,y) that intersects P do {
calculate z-depth of P at (x,y)
if z-depth < z-buffer[x,y] then {
Intensity[x,y] = intensity of P at (x,y)
z-buffer[x,y] = z-depth
Display Intensity array
Buy me a Cup of Coffee

Software Engineer,, Indore

Software Engineer,, Indore

For guest faculty Contact us on following E-mail ID:

Note: We have been used search engines for gathering content.

free counters

No comments:

Post a Comment