Sign in to follow this  
gchewood

Multisampling in XNA?

Recommended Posts

gchewood    236

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!

Share this post


Link to post
Share on other sites
DwarvesH    510

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.

Share this post


Link to post
Share on other sites
gchewood    236

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? 

Share this post


Link to post
Share on other sites
DwarvesH    510
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.

Share this post


Link to post
Share on other sites
phil_t    8084


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.

Share this post


Link to post
Share on other sites
gchewood    236

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this