Anti-aliasing: Kill Those Jaggies!

What are Jaggies

We have diffuse and specular lighting and shadows, things look pretty nice . . . except for those jaggies. What are jaggies you say? They are technically called aliasing, and it comes from the fact that computer screens are made up out of pixels. Pixels have a size, while very small, they still have an area. Aliasing happens when say a line goes through they corner of a two pixels. Well a pixel has to turn all of itself on or none. It can't have half a pixel on. And this creates those jagged edges. Look here at this example. The left image has a smooth looking circle, then on the middle image I've overlayed a grid, imagine each square to be a pixel on the screen. Notice how some squares are only partially filled. Since we can't have only half the pixel glowing we must fill in the whole square. This produces the rough "jagged" image on the right.

Show Me Some Real Life Jaggies

Now that you understand what they are, here are two images of our scene, the left one has very prominent jaggies, the right one has much less noticeable ones.



If we zoom in on the green sphere and on the floor we can really those jaggies. The far right image is the middle one enlarged by a factor of two.

Let's Fix Them!

So how do we fix it? Its rather simple. In ray tracing we shoot a ray through each pixel of the image and remember that the whole pixel must glow so this creates jaggies. However, we can get rid of them by shooting a ray between pixels and averaging them up to find the final value for a single pixel. This technique of sending in more rays is called super-sampling So for the following images instead of one ray per pixel, nine rays were cast, a three by three grid.These images are of the same regions as the previos there.