Sign in to follow this  

[XNA] Mipmap generation oversampling

This topic is 3311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Having trouble with XNA 3.0's automatic generation of mipmaps... It appears that you can't control the texture addressing mode whilst the mipmap chain is created. During rendering I set the texture addressing mode to Clamp, otherwise my non-wrapping textures produce oversampling artifacts on their edges. Unfortuately these texture artifacts are still showing up at certain scalings, as they exist in the mipmap chain. My current workaround is to simply use Box filter during texture creation, as its sampling algorithm by default doesn't seen to oversample. Rendering can then use better filtering. I'd like to use something 'better' than the Box filter though, as for me quality is more important than speed. Any ideas?

Share this post


Link to post
Share on other sites
DDS texture files (.dds) support specifying the MIP map contents explicitly. That is, you can provide a different image for each level of the chain. While this requires extra disk space (~30% more), it isn't that bad, and loading speeds should be better (no runtime MIP creation). Most importantly, XNA shouldn't mess around with the MIP data and should load the maps provided in the file.

Hope this helps.

Share this post


Link to post
Share on other sites
Thanks sirob, unfortunately the app will never know which assets it'll need before it runs... Its got to cope with any image you care to throw at it at runtime.

I'm in two minds as to whether this should be reported as an XNA bug...

On the one hand I understand what the issue is. So can work round it.

On the other... when you render with texture clamping on you don't expect to see this top/bottom left/right texture contamination.

Share this post


Link to post
Share on other sites
Why not create your own mip-map generation routine if the one provided doesn't produce adequate results? It'll take some coding, but should be fairly straightforward. There also should be plenty of resources available for such a common topic.

Also it might sound pedantic, but the term oversampling actually has a pretty specific meaning in signal processing that's not related to your problem. I know what you mean here in this case when you say "oversampling", but I just thought I'd point that out for you. [smile]

Share this post


Link to post
Share on other sites
Hi MJP. No worries, as a world class pedant myself I simply feel a warm glow when I see such things pointed out. [oh]

In the spirit of not pre-optimising this project into obsolenence, I'm going to make a note of it and move swiftly on. Box filtering will be fine. [smile]

Share this post


Link to post
Share on other sites

This topic is 3311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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