1

Having some issues with smooth alpha gradients in texture files resulting in bad banding issues.

I have a 2D XNA WP7 game and I've come up with a fairly simple lighting system. I draw the areas that would be lit by the light in a separate RenderTarget2D, apply a sprite to dim the edges as you get further away from the light, then blend that final lighting image with the main image to make certain areas darker and lighter.

Here's what I've got so far:

spotlight mask

light banding example

As you can see, the banding is pretty bad. The alpha transparency is quite smooth in the source image, but whenever I draw the sprite, it gets these huge ugly steps between colors. Just to check I drew the spotlight mask straight onto the scene with normal alpha blending and I still got the banding.

Is there any way to preserve smooth alpha gradients when drawing sprites?

4

2 回答 2

1

Is there any way to preserve smooth alpha gradients when drawing sprites?

No, you cannot. WP7 phones currently use 16 bit color range system. One pixes got: 5 red bits, 5 blue, 6 green (humans see a wider spectrum of green color).

于 2012-04-23T04:13:59.850 回答
1

发现使用 Mango,应用程序现在可以指定它们支持 32bpp,并且它可以在支持它的设备上运行!

没有光带示例

对于 XNA,将此行放在顶部OnNavigatedTo

SharedGraphicsDeviceManager.Current.PreferredBackBufferFormat = SurfaceFormat.Color;

对于 Silverlight ,添加BitsPerPixel="32"到.AppWMAppManifest.xml

于 2012-05-02T01:21:58.267 回答