I've spent all weekend struggling with getting Anti-Aliasing (AA) working with XNA 4. I compared my old XNA 3.1 version with my updated XNA 4 version and noticed that the graphics on the menus looked awful on the new one!
This was obviously because AA, multi-sampling, was not enabled on the new version. Some of the settings used to enable this in XNA 3.1 had been replaced in XNA 4. I therefore spent a lot of the weekend on the assumption that I just needed to get the settings right within XNA.
I asked for help on the XNA forums so you can read the saga there as well.
To demonstrate the problem, the following rather rough picture is a small portion of the screen illustrating the effect:
These three lines turn off anti-aliasing in XNA 4.0 and do nothing in XNA 3.1!
MinFilter = Point;
MagFilter = Point;
MipFilter = Point;
I removed those three lines and everything was back to what I expected. This is the end result:
I've gone a little further and checked out the other options for the texture filters when set within the HLSL fx file. I got the options from the following web page:
The results are:
Min, Mag and Mip filters = Point -> AA gets turned off
Min, Mag and Mip filters = Linear -> AA works
Min and Mag filters = Anisotropic -> AA works
Mip filter = None -> AA works but the result was grainy
Min and Mag filters = PyramidalQuad -> Failed to compile
Min and Mag filters = GaussianQuad -> Failed to compile
My conclusion is that I should remove everything from my HLSL effect files that can now be set within XNA 4.0 and I should set those from within XNA. As always one of Shawn Hargreaves blog posts is most useful for that.
[Edit: change of plan again. I completely re-wrote my shaders and now the filtering is in XNA code... again.]