## 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.

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

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

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

- Plot the estimated color for each sampling pattern. What do you notice?
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.

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?)

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.

Suppose you've computed all the intersections between the triangle edges and the pixel edges. How can we sort the vertices

**q**i of the region*R*given by the intersection of the pixel and the triangle?Given a sorted list of vertices

**q**1, ...,**q**n for*R*, how can we compute the final coverage value?Given everything we've said and done above, do you think the exact strategy is worth it? Or should we stick to sampling?

What are some aspects of rasterization

*not*captured by the exact approach outlined here?