我正在使用XNA 3.0,我想对具有多个3d对象的3d场景使用抗锯齿。我去了msdn网站并实施了MSAA,但我仍然看到锯齿状的边缘。是因为我没有为每个对象渲染反别名吗?
这是cose片段:
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.PreferMultiSampling = true;
graphics.PreparingDeviceSettings +=
new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
}
void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
int quality = 0;
GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter;
SurfaceFormat format = adapter.CurrentDisplayMode.Format;
// Check for 4xAA
if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format,
false, MultiSampleType.FourSamples, out quality))
{
// even if a greater quality is returned, we only want quality 0
e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 0;
e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType =
MultiSampleType.FourSamples;
}
// Check for 2xAA
else if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format,
false, MultiSampleType.TwoSamples, out quality))
{
// even if a greater quality is returned, we only want quality 0
e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 0;
e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType =
MultiSampleType.TwoSamples;
}
return;
}