# 8 Sampling and Reconstruction

Although the final output of a renderer is generally a 2D grid of colored pixels, incident radiance is actually a continuous function defined over the film plane. The manner in which the discrete pixel values are computed from this continuous function can noticeably affect the quality of the final image generated by the renderer; if this process is not performed carefully, artifacts will be present. Conversely, if it is performed well, a relatively small amount of additional computation to this end can substantially improve the quality of the rendered images. We have thus far approached this topic from the perspective of Monte Carlo integration, though other viewpoints can also give useful insight.

This chapter starts by introducing *sampling theory*—the theory of
taking discrete sample values from functions defined over continuous
domains and then using those samples to reconstruct new functions that are
similar to the original. In `pbrt`, integration is more often the goal than
reconstruction is, though we will see that Fourier analysis—the
foundation of sampling theory—also provides insight about error in Monte
Carlo integration. We discuss those connections as well as other
approaches for evaluating the quality of sampling algorithms in the second
section of this chapter.

With these ideas in hand, the implementations of six `Sampler`s make
up the bulk of this chapter. They span a wide variety of approaches to the
sampling problem. The chapter concludes with the `Filter` class,
which determines how multiple samples near each pixel are blended together
to compute the final pixel value. Both of `pbrt`’s `Film`
implementations use these filters to accumulate image sample contributions
into pixels of images.