1

我想在运行时启用/禁用 MSAA,为了做到这一点,我有这个功能:

GraphicsDeviceManager _graphics = new GraphicsDeviceManager(this)
...

private void ChangeMsaaSetting(bool enable)
{
    _graphics.PreferMultiSampling = enable;

    var rasterizerState = new RasterizerState
    {
        MultiSampleAntiAlias = enable,
    };

    GraphicsDevice.RasterizerState = rasterizerState;
    GraphicsDevice.PresentationParameters.MultiSampleCount = enable ? 2 : 0;

    _graphics.ApplyChanges();
}

在我称之为之前,一切都很正常:场景中的对象是用像素化边缘渲染的。一旦我调用了传递函数true,模型就会消失,剩下的就是我清除的 CornflowerBlue 背景GraphicsDevice

但是在我调用ChangeMsaaSetting(false)对象之后再次开始渲染。

MultiSampleCount我做了一些实验,如果设置为大于 1 的整数,似乎对象会消失。奇异样本是无用的,所以我需要在那里有一个更大的值。难道我做错了什么?

4

1 回答 1

0

单体游戏目前不支持 MSAA。请改用https://github.com/SeriousMaxx/FXAAMonoGame

它将提供非常高质量的后期处理 AA。

于 2016-11-28T02:54:57.520 回答