13 - Rasteriazation Flashcards
Vector vs. Raster
Vector graphics generally produce clearer images than raster graphics,
They involve re-calculating and drawing the graphics when changing the size,
whereas raster graphics is a simple zoom in/out on the same resolution.
Rasterization
is the conversion of ideal, mathematical
graphics primitives onto raster displays.
Rasterisation takes the continuous value graphical objects and converts them to discrete values in the framebuffer
What is a fragment
A fragment in OpenGL is all the data required for OpenGL to render a
single pixel
Fragment Value Interpolation
Shading can be done using flat, Gouraud or Phong methods (among others).
Interpolation is needed in these instances to determine the value of each of the pixels shown on the object’s surface.
Linear Interpolation Using Barycentric Coordinates
A property value at any point x can be interpolated from the values at vertices A1, A2, A3:
f (P) = t1f (A1) + t2f (A2) + t3f (A3)
t1,t2,t3 represent the area ratios of the sub-triangles, ie:
t1 = area[T(P, A2, A3)] / area[T(A1, A2, A3)]
Hence inside the triangle 0 ≤ ti ≤ 1 we have t1 + t2 + t3 = 1.
Parity Rule
if you draw a line from a point inside the curve to a point infinitely far away, the line will intersect the curve an odd number of times.
Based on the count of intersections, determine if the current scanline is inside or outside the polygon.
If the number of intersections is odd, the scanline is inside the polygon; if it’s even, the scanline is outside.
Filling polygons
parity rule and non-zero winding number :
to determine whether a point is inside or outside a polygon. This information is essential for determining which pixels should be filled when rendering the polygon.
Non-Zero Winding Number
a point is inside is the polygon winds clockwise around the point a non-zero number of times
Scanline
horizontal line being rasterised by the graphics hardware to generate an image.
Scanline Algorithm
objects in a scene tend to change slowly as they move across a scan line.
For each scan line:
1. Find intersections of the scan line with all polygon edges
2. Sort the intersections into increasing of x coordinate
3. Fill alternate segments of the scan line (spans) according to the parity rule (i.e. in-out-in-out etc.)
To ensure that the polygons fit together without holes, the following rules can be applied in each intersection situation:
- Integer intersections
- Fractional intersections
- Horizontal edges
Scanline Interpolation
Use Z-buffer algorithm to:
determine screen locations of vertices
Intensities or normals interpolated from vertices
Interpolate along scanline from edges