Exercises 04: Rasterization and Sampling

Calculating Coverage

In lecture we claimed that computing exact coverage is not practical, and quickly went down the route of sampling. But then we discovered that sampling can cause nasty aliasing artifacts. Is the exact approach really so bad? And is sampling really so good? Let's explore these questions a bit, by trying to compute the coverage of a single pixel by triangles.

  1. What's the exact percentage of coverage for the triangle shown below?

    A red triangle covering part of a pixel

  2. For each of the sampling patterns below, what's the estimated coverage?

    Increasingly dense sampling patterns for a triangle in a pixel

  3. Plot the coverage as a function of the number of samples. What do you notice?

  4. Plot the estimated color for each sampling pattern. What do you notice?
  5. For each of the sampling patterns below, draw one or more triangles such that the sampled coverage will give a poor approximation of the true coverage.

    Sampling patterns in a pixel with no geometry shown

  6. Can you think of a sampling strategy that provides a reasonable estimate of coverage even for adversarial inputs? (I.e., even if someone tries as hard as a possible to draw triangles that yield a bad estimate, your clever sampling strategy is still expected to product a decent approximation of coverage?)

  7. Suppose now we want to compute the exact coverage within a pixel for a single triangle. Sketch a high-level procedure for computing this value.

  8. Suppose you've computed all the intersections between the triangle edges and the pixel edges. How can we sort the vertices qi of the region R given by the intersection of the pixel and the triangle?

    A triangle covering a pixel and the same triangle clipped to the pixel

  9. Given a sorted list of vertices q1, ..., qn for R, how can we compute the final coverage value?

  10. Given everything we've said and done above, do you think the exact strategy is worth it? Or should we stick to sampling?

  11. What are some aspects of rasterization not captured by the exact approach outlined here?