# Loss of texture detail in XNA (Banding 16 bit issue)

I'm loading in a background texture for my game, it's not vert detailed, it's just there too add some variance. The problem is that there looks like a large reduction in detail. I've included images below so you can see what I'm talking about. What would cause this to happen and how can I get my detail back?

Verticies are VertexPositionTexture
Load method Texture2D.FromStream
Effect BasicEffect

Also the project is a Silverlight/XNA mix

Source Image:

Image from game:

Note: the images don't match up completely but you should get the idea.

Your texture is a 32 bit texture. Somewhere between loading it and displaying it, it is getting downsampled to 16-bits (or some other low bit-depth). The loss of precision gets rid of the smooth gradients and gives you bands of colour like that.

None of the things you have mentioned (loading it with LoadStream, drawing it with BasicEffect with that vertex format) will reduce precision like that.

My bet is that you're rendering to a 16-bit backbuffer. I can get a similar result by setting:

graphics.PreferredBackBufferFormat = SurfaceFormat.Bgr565;
graphics.IsFullScreen = true;


You can verify your actual backbuffer format (note that what you specify to GraphicsDeviceManager is just a preference) by checking:

GraphicsDevice.PresentationParameters.BackBufferFormat


It's also possible you're using a low-precision render target somewhere.

• Yeah DisplayMode.Format is saying Bgr565 would you recommend changing it or using a 16-bit texture (assuming I can do that and it would look alright)? This is also an XNA/Silverlight project so I'm not sure if the SharedGraphicsDevice would like it.. – Daniel Little Aug 17 '12 at 11:43
• Also it's a WP7 Game – Daniel Little Aug 17 '12 at 11:46
• I'm not up to speed with the surface limitations of WP7. If you can do a 32-bit backbuffer, that is easier. But 16-bit might have some performance benefits (less memory, more compact data). Either way, you should probably keep your textures and backbuffer in the same format. If you must have a 16-bit texture, look into dithering to fake the gradient at a lower bit-depth. – Andrew Russell Aug 17 '12 at 11:49
• Yeah, I think certain devices only have 16-bit screens so I'll look into changing the texture. – Daniel Little Aug 17 '12 at 11:57

By default, in Windows Phone 7 all apps use 16 bits per pixel graphic mode. To switch it to 32 bits, see here: https://stackoverflow.com/a/10313783/126995. This is only available since WP 7.1 Mango, but since every WP7 device can be upgraded to WP 7.1, it's no big deal.

• Sorry but switching to 32 bit has it's own problems, firstly there are WP7 devices that only support 16 bit so you'd still get banding. Second there is a performance penalty for doubling the format size. That's important to me because the more I do the less time I can do it for.. these are mobile devices after all. – Daniel Little Aug 19 '12 at 10:47
• Lavinski, could you please tell me what models don't support 32 bits? Or where you get that information? I'm currently developing an app (almost finished), and our designer created a UI that needs full-color display to look good :-( – Soonts Aug 20 '12 at 21:07
• I was unable to tell if any devices actually don't support the Color format however the hardware spec only specifies a 16-bit LCD at minimum. – Daniel Little Aug 20 '12 at 23:26
• OK, thanks anyway. I think we'll go live anyway, and listen to the user's feedback :-) OTOH, Wikipedia's article "Windows Phone version history" says "32 bit color support for Silverlight applications with hardware dithering", unfortunately I was unable to google any evidence for/against that.. – Soonts Aug 22 '12 at 5:04