This preview shows page 1. Sign up to view the full content.
Unformatted text preview: e polygon.
2.Sort the intersections in the
increasing order of the x coordinate.
3.Fill in all pixels between pairs of
Can also deal with concave
polygons Span extrema
Only turn on pixels whose centers are
interior to the polygon:
Otherwise will intrude other adjacent polygons round up values on the left edge of a span,
round down on the right edge Scanline Algorithm
Cons and Pros
- Simple - Very serial (cannot be efficiently parallelized)
- Special cases require exception handling Triangle Rasterization by
● Can check whether a pixel is inside / outside the
● Can interpolate the attributes at the vertices
● Often used in modern graphics cards
● Can be easily parallelized Triangle Rasterization * Barycentric Coordinates * Computing Barycentric Coordinates
The triangle is composed of 3 points
p0 (x0,y0), p1 (x1, y1), p2(x2,y2).
For point (x,y), its barycentric coordinates can be
where Bounding Box of a Triangle
Calculate a tight bounding box for a triangle:
simply calculate pixel coordinates for each
vertex, and find the minimum/maximum for each
min (x0,x1,x2), max (x0,x1,x2)
min (y0,y1,y2), max (y0,y1,y2) * Scanning inside the triangle
● For each pixel, compute the barycentric
● Color it if all the three values are in the
range of [0,1] * Interpolation by Barycentric
We can use the barycentric coordinates to
interpolate attributes of the triangle vertices
•color, depth, normal vectors, texture
c3 Interpolation of Depth
•When triangles are overlapped, need t...
View Full Document
This document was uploaded on 03/26/2014.
- Spring '14