<p>From a signal processing point of view, you're sampling a continuous-domain signal, and you need to filter it to get rid of frequencies beyond the Nyquist limit. It's that filtering that leads to integrating over the pixel area—or more generally, integrating over the support of your antialiasing kernel (which need not be a box).</p>

<p>Consider your rendering function that takes a sample point $x, y$ in screen space and returns back the color found at that point. (Let's ignore any issues of random sampling for the moment, and assume it returns a "perfect" rendered color for that specific point.) This function effectively defines a 2D continuous-domain signal. Or to put it another way, it defines an <em>infinite-resolution</em> image, since nothing prevents this function from having features at arbitrarily small scales. In terms of frequency domain: the function is not band-limited; it can include components of arbitrarily high spatial frequencies.</p>

<p>Now you want to convert it down to a finite number of pixels. Much like digitizing an audio signal, when you sample it, you'll get aliasing unless you first eliminate frequencies beyond the Nyquist limit imposed by the sampling rate. In other words, you have to get rid of features smaller than the pixel grid. To do this, you apply a low-pass filter. The <em>ideal</em> low-pass filter is the sinc function, but for various reasons of practicality we use other filters (that don't perfectly eliminate frequencies beyond the Nyquist limit, but they at least attenuate them).</p>

<p>Low-pass filtering is done by convolution. If $f(x, y)$ is the rendering function and $k(x, y)$ is a filter kernel, then we can define the low-pass filtered image as:</p>

<p>$$f_\text{filtered}(x, y) = \iint f(x', y') \, k(x' - x, y'- y) \, dx' \, dy'$$</p>

<p>Then the image is safe to sample, so the final pixel values are gotten by just evaluating $f_\text{filtered}$ at the pixel coordinates.</p>

<p>If $k$ is a box filter, which looks like $k = 1$ within the pixel box and $k = 0$ elsewhere, then this simplifies to just integrating $f$ over the pixel box. But as noted, the box filter isn't so great and there are better choices such as tent, bicubic, and Gaussian filters.</p>

<p>Anyway, now that we have an integral, we can use Monte Carlo for it and combine it with any other integrals we might like to do—for lighting, motion blur, and so on. We can even apply importance sampling to the $k$ factor in the integral, by generating samples for each pixel that are distributed around the pixel center according to $k$.</p>

CC BY-SA 3.0
2016-09-20T10:38:59.547Z
Excellent answer, as always.
ivokabel
CC BY-SA 3.0
2016-09-17T04:17:53.697Z
2016-09-17T04:17:53.697Z
Nathan Reed
<p>You are in fact doing both things. You are integrating the area and because your result is still discrete samples you are reconstructing the signal to make it continious function. Therefore the higher order filtering. (Also human eye is a discrete sampler so it also reconstructs the signal)</p>

<p>It took me a considerable amount of time to come into terms with this explanation. The thing that helped me was a paper by Tony Apodaca titled <a href="https://renderman.pixar.com/view/the-lore-of-the-tds" rel="nofollow">The Lore of TDs</a>.</p>

CC BY-SA 4.0
2019-01-01T23:53:24.233Z
Looks like that link is gone now. What title were you referring to as the best 3d primer you’ve read?
johnbakers
CC BY-SA 3.0
2016-09-16T18:47:58.780Z
Thanks for the great link! the last link on that page seems to dive right into this.  In practical terms, do you happen to know if doing anything above a box blur really gives much visual difference? Or would it give any boost to convergence?
Alan Wolfe
CC BY-SA 3.0
2016-09-16T19:02:08.410Z
Its the best primer to 3D graphics rendering concepts that i have ever seen (Tough its not so much about physical based or tracing stuff but anyway). A sinc filtered image is much sharper than the box filter gives a very blurred look and feel. Would it converge faster, I doubt it.
joojaa
CC BY-SA 3.0
2016-09-16T18:32:05.067Z
2016-09-16T18:32:05.067Z
joojaa
<p>In graphics, it's common to take multiple samples within the bounds of a pixel and combine them together (most commonly just doing an average) for a final sample pixel color.  This has the effect of anti aliasing an image.</p>

<p>On one hand this makes sense to me because what you are effectively doing is integrating the color of the pixel over the area that the pixel represents.  In this line of thinking, averaging "random" samples seems to be the ideal setup, for doing monte carlo integration.  ("random" could be stratified, blue noise based, low discrepency sequences etc)</p>

<p>On the other hand, this feels wrong (or at least not as correct as it could be) from a digital signal processing point of view.  From that point of view, it feels like we are taking a lot of samples and then downsampling using a box filter (box blur) to get the final pixel value.  In that light, it seems like the ideal thing to do would be to use sinc filtering instead of averaging the samples.  I could see that the box filter is a cheaper aproximation to sinc thinking along these lines.</p>

<p>This leaves me a bit confused.  Is the core idea that we are integrating the pixel area and averaging is correct?  Or is it that we are downsampling and should be using sinc, but are using a box filter because it's fast?</p>

<p>Or is it something else entirely?</p>

<p>A little bit related: <a href="https://computergraphics.stackexchange.com/questions/2130/anti-aliasing-filtering-in-ray-tracing">Anti-aliasing / Filtering in Ray Tracing</a></p>

CC BY-SA 3.0
2016-09-16T18:04:09.997Z
I'm finding some answers here: http://groups.csail.mit.edu/graphics/classes/6.837/F04/lectures/14_Sampling-used6.pdf
Alan Wolfe
<sampling><antialiasing><supersampling>
What is the fundamental reasoning for anti aliasing using multiple random samples within a pixel?
Alan Wolfe
# What is the fundamental reasoning for anti aliasing using multiple random samples within a pixel?

(Asked by: username_0 on 2016-09-16)

In graphics, it's common to take multiple samples within the bounds of a pixel and combine them together (most commonly just doing an average) for a final sample pixel color. This has the effect of anti aliasing an image.

On one hand this makes sense to me because what you are effectively doing is integrating the color of the pixel over the area that the pixel represents. In this line of thinking, averaging "random" samples seems to be the ideal setup, for doing monte carlo integration. ("random" could be stratified, blue noise based, low discrepency sequences etc)

On the other hand, this feels wrong (or at least not as correct as it could be) from a digital signal processing point of view. From that point of view, it feels like we are taking a lot of samples and then downsampling using a box filter (box blur) to get the final pixel value. In that light, it seems like the ideal thing to do would be to use sinc filtering instead of averaging the samples. I could see that the box filter is a cheaper aproximation to sinc thinking along these lines.

This leaves me a bit confused. Is the core idea that we are integrating the pixel area and averaging is correct? Or is it that we are downsampling and should be using sinc, but are using a box filter because it's fast?

Or is it something else entirely?

A little bit related: [Anti-aliasing / Filtering in Ray Tracing](https://computergraphics.stackexchange.com/questions/2130/anti-aliasing-filtering-in-ray-tracing)

**Tags:** sampling, antialiasing, supersampling

> **Comments:**
> **username_0**: I'm finding some answers here: http://groups.csail.mit.edu/graphics/classes/6.837/F04/lectures/14_Sampling-used6.pdf  

---

## 2 answers

### Answer by username_1 on 2016-09-17. Score: 9 | Accepted answer

From a signal processing point of view, you're sampling a continuous-domain signal, and you need to filter it to get rid of frequencies beyond the Nyquist limit. It's that filtering that leads to integrating over the pixel area—or more generally, integrating over the support of your antialiasing kernel (which need not be a box).

Consider your rendering function that takes a sample point $x, y$ in screen space and returns back the color found at that point. (Let's ignore any issues of random sampling for the moment, and assume it returns a "perfect" rendered color for that specific point.) This function effectively defines a 2D continuous-domain signal. Or to put it another way, it defines an *infinite-resolution* image, since nothing prevents this function from having features at arbitrarily small scales. In terms of frequency domain: the function is not band-limited; it can include components of arbitrarily high spatial frequencies.

Now you want to convert it down to a finite number of pixels. Much like digitizing an audio signal, when you sample it, you'll get aliasing unless you first eliminate frequencies beyond the Nyquist limit imposed by the sampling rate. In other words, you have to get rid of features smaller than the pixel grid. To do this, you apply a low-pass filter. The *ideal* low-pass filter is the sinc function, but for various reasons of practicality we use other filters (that don't perfectly eliminate frequencies beyond the Nyquist limit, but they at least attenuate them).

Low-pass filtering is done by convolution. If $f(x, y)$ is the rendering function and $k(x, y)$ is a filter kernel, then we can define the low-pass filtered image as:

$$f\_\text{filtered}(x, y) = \iint f(x', y') \, k(x' - x, y'- y) \, dx' \, dy'$$

Then the image is safe to sample, so the final pixel values are gotten by just evaluating $f\_\text{filtered}$ at the pixel coordinates.

If $k$ is a box filter, which looks like $k = 1$ within the pixel box and $k = 0$ elsewhere, then this simplifies to just integrating $f$ over the pixel box. But as noted, the box filter isn't so great and there are better choices such as tent, bicubic, and Gaussian filters.

Anyway, now that we have an integral, we can use Monte Carlo for it and combine it with any other integrals we might like to do—for lighting, motion blur, and so on. We can even apply importance sampling to the $k$ factor in the integral, by generating samples for each pixel that are distributed around the pixel center according to $k$.

> **Comments:**
> **username_2**: Excellent answer, as always.  

---

### Answer by username_3 on 2016-09-16. Score: 4

You are in fact doing both things. You are integrating the area and because your result is still discrete samples you are reconstructing the signal to make it continious function. Therefore the higher order filtering. (Also human eye is a discrete sampler so it also reconstructs the signal)

It took me a considerable amount of time to come into terms with this explanation. The thing that helped me was a paper by Tony Apodaca titled [The Lore of TDs](https://renderman.pixar.com/view/the-lore-of-the-tds).

> **Comments:**
> **username_0**: Thanks for the great link! the last link on that page seems to dive right into this.  In practical terms, do you happen to know if doing anything above a box blur really gives much visual difference? Or would it give any boost to convergence?  
> **username_3**: Its the best primer to 3D graphics rendering concepts that i have ever seen (Tough its not so much about physical based or tracing stuff but anyway). A sinc filtered image is much sharper than the box filter gives a very blurred look and feel. Would it converge faster, I doubt it.  
> **username_4**: Looks like that link is gone now. What title were you referring to as the best 3d primer you’ve read?  

---

