Multisampling in XNA?

Started by
4 comments, last by gchewood 10 years ago

Hey guys, simple question. How do you change the multisample count/quality in Xna 4?

I've seen plenty of articles talking about it back in xna 3.1 but none for 4.

And what different options are there? I've seen a project that chose between 2x and 4x. I know some modern games (and unity I believe) do 8x now.

Thanks muchly!

Advertisement

I did find some documentation on the Microsoft site for this a while ago but I can't find it again. You were selecting sample count on a device reset handler or something like this.

Without being able to locate that resource again all I can do is tell you that if you use render targets, you can create the render target with a given sample count. No support for non 0 quality levels on render targets though.

Yeah, I've seen that you can (supposedly) set the multisample count when you instantiate a rendertarget2D.

I'm rather suspicious as to whether it's doing anything (or maybe I'm missing something else) because I've compared screenshots between supposed 2 and 8 multisample counts and they look identical. Also, it doesn't throw any kind of exception if you stick in a 900 count or something ridiculous.

So I'd conclude that there's either a bug that it's far too late to expect a solution to or you have to do something else on top of that that I'm missing?

No no, render targets work. I have a solution working in front of my eyes right now. I don't think I did anything special for it to work. The only thing I couldn't figure out was how to determine the maximum supported setting. If you put something wrong, it gets ignored, no exception raised.


I'm rather suspicious as to whether it's doing anything (or maybe I'm missing something else) because I've compared screenshots between supposed 2 and 8 multisample counts and they look identical. Also, it doesn't throw any kind of exception if you stick in a 900 count or something ridiculous.

XNA is probably just ignoring it and setting it to a valid value. You can trivially check this in the debugger, as the RenderTarget2D has a MultiSampleCount. If I put in 900, I get a RenderTarget2D with 8 for MultiSampleCount.

As for screenshots looking identical - what are you drawing? Multisampling will only make a difference on the edges of your geometry. So if you're, say, drawing a full screen texture with SpriteBatch or something, you won't see any difference.

Sorry about the delay, busy week. Thanks for pointing out that 900 will be truncated to 8. I guess that makes sense.

Haha and yes, I understand what multisampling does. I'm just drawing a regular scene with an environment (trees, bridges etc) and some characters. But no noticable difference (in visuals OR framerate).

Whereas in something like Unity, the difference between 2x and 8x is incredibly clear. If anyone can post screenshots of a noticeable difference in XNA 4, I'd love to hear from them!

Thanks

This topic is closed to new replies.

Advertisement