The DirectX parameters however are throwing me for a curve. I can't find any information on how the video cards actually perform the sampling internally, or any kind of decent documentation on what the parameters actually mean in terms of quality vs. performance.
There are many variants, but I'll start with explaining how 4x regular super-sampling works. If you're working in a 800x600 screen resolution, then it uses a 1600x1200 buffer internally. So every pixel on the screen corresponds to four pixels in the internal buffer. The complete scene is rendered in this high resolution, and then it is downsampled (shrunk) to the screen resolution by averaging the groups of four pixels together.
Multi-sampling is an optimization of this. Rendering in a 1600x1200 resolution requires four times more work than rendering in 800x600 mode, so there's a huge performance hit. What they do is sample textures only once per group of four pixels (corresponding to one pixel one the 800x600 screen), and do the lighting calculations also just once. It still renders the triangles in the high resolution, so especially for edges it knows which of the four pixels belong to the current polygon. So after the scene is rendered we again average the pixels of the big buffer together, so we get anti-aliasing at the edges. In other words, the edges are super-sampled, while the interior of the polygons is rendered as if it was in 800x600 resolution.
The only disadvantage of multi-sampling over super-sampling is that aliasing effects can occur inside the polygon. But mostly this is not as noticable as jaggies, and we have anisotropic filtering...
What about anisotropy? It always seems to come into the same discussion as antialiasing. Video cards often boast up to 8 or 16 levels of anisotropy, but what does that mean exactly? How do I specify those levels using directx? I noticed a SamplerState referring to Anisotropy, but it says MaxAnisotropy ... is that all there is to it? Again, is the performance such that either off or full is a good default? What is the anisotropy algorithm anyway, and how does it differ from vanilla linear filtering?
When we render a square, say 256x256 pixels, and we use a square texture of the same size, it will look splendid. But if we tilt that square backward, it becomes more like a rectangle, being more wide than heigh. Let's say it's dimensions are 256x32, roughtly. This means that the texture that we map onto it is compressed 8 times in the vertical direction. In other words, we would skip 7/8 lines. All that information is lost. It also causes flickering, aliasing, because when you shift the tilted square up and down, other horizontal lines will become visible and others dissapear. To avoid the flickering, we use a 32x32 version of the texture, where blocks of 8x8 pixels of the original texture are nicely averaged together. This is also a loss of information, but it stops the flicker. This is what is done with regular mip-mapping. The biggest disadvantage is that we now have 32 pixels horizontally in the texture, mapped onto 256 pixels on the screen. So we're stretching it out, making it look blurry.
What we really wanted is to average 1x8 pixels together, so we'd get a 256x32 texture. But that doesn't work when we start rotating the square. And it also requires a lot of extra memory. The alternative, is to sample the texture 8 times per pixel, in the direction in which the polygon is tilted. That's anisotropic filtering. It's called anisotropic because it doesn't matter how the square is rotated, it can take 8 samples in the texture in any direction required, and average them together.
Now you probably wonder why they don't use super-sampling again then? Well, super-sampling works in a fixed pattern. Regular 4x super-sampling takes two samples vertically, and two horizontally. When the square is tilted backward, we don't care (much) about the extra samples horizontally. We only really need the samples in the vertical direction, to avoid aliasing and blur. Furthermore, the lighting caluculations would be done multiple times per pixel when using super-sampling, while once suffices. With anisotropic filtering, the only cost is taking the extra samples in the texture and averaging them together. This is not that expensive in hardware, much easier than using eight times more complete pipelines.
So, multi-sampling and anisotropic filtering is like a perfect marriage. The first one avoids aliasing at the edges, the second avoids aliasing and blur inside the polgyons!