The images produced by our ray tracer so far have jagged edges around the geometry in the scene. This is because we have only cast one ray per pixel. That ray either sees some geometry, or it doesn't, leading to sharp transitions. This is known as aliasing, because, due to the imprecision of sampling once per pixel, two different scenes may produce the same output image.
The solution is to cast multiple rays per pixel—each at a different point inside the pixel—then average the results together for that pixel. This approach is known as distributed ray tracing, where multiple rays are cast and the results averaged. While the locations sampled can be regularly spaced inside the pixel, we can also cast rays to randomized locations within the pixel, an approach known as stochastic ray tracing.
When used to avoid aliasing, the technique is called supersampling antialiasing, or SSAA. Often, the number of samples is used in the name, such as 4× SSAA.
The increased quality comes at a cost. The number of rays cast in total is multiplied by the number of samples per pixel, resulting in doing that many times more work for a single image.
A related technique is multisampling antialiasing or MSAA, where multiple samples are only taken at the edges of the geometry. This alleviates the performance hit of supersampling antialiasing.
The general principle of distributed ray tracing can be applied to simulate many photorealistic effects:
By distributing the rays through time, a moving object will be subject to motion blur.
By distributing the origin of the camera ray over a 2D interval, depth of field can be simulated.
By modeling a light source as a 2D interval and distributing shadow rays over that interval, soft shadows can be rendered.