Not possible to have AA/multisampling in a RenderTarget2D?

Currently, Monogame crashes when I try to create RenderTarget2D with multisampling/antialiasing:

    renderTarget = new RenderTarget2D(device,
                     pp.BackBufferWidth, pp.BackBufferHeight, false,
                      pp.BackBufferFormat, pp.DepthStencilFormat, 4, RenderTargetUsage.PreserveContents);

So multisampling/antialiasing only works on the back buffer. Any rendering that requires multiple steps, such as edge enhancement, will have degraded visuals compared to XNA.

There is an issue logged in GitHub:

but it seems to have stalled… Is it possible to give this issue a higher priority somehow…?
Note: I feel helpless but also thankful that Monogame exists.

There’s an open issue specifically for render target anti alias: https://github.com/MonoGame/MonoGame/issues/1162
Incidentally I had a look at this today and decided I’ll have a go at it. I have some other stuff on my list first though.

There is no way to set priorities for issues, but there are milestones and there is an anti alias issue with the 3.6 milestone (but for the backbuffer). It makes sense to fix that issue and the render target one in one go, so I guess that is sort of a priority

Awesome! This would be great to have in our release.

this issue has been up for quite a time. Maybe you can include the option for SuperSampling, if your game is not super intense graphics wise, or go for SMAA. :confused:

I’ve just had a look into this as part of PR #5083. Multisample support is indeed not implemented correctly for all the render target types. I had started to fix it as part of that PR, but it was going way beyond the scope of that PR so it will need to become a PR on its own.

1 Like