1
\$\begingroup\$

I have a problem with bandings using andengine. When painting a picture on PC and uploading it to my phone, they look exactly the same. But as soon as I use that bitmap (PNG) in Andengine, I have bandings (big color steps).

Now I know that my display is capable of displaying the image right and I know how to us dithering but it bothers me. Does anyone know how to disable this quality reduction in Andengine?

\$\endgroup\$
  • \$\begingroup\$ Post the code you are using to load the texture. If you are using the RGBA_4444 type of texture, that might be one of the reasons. \$\endgroup\$ – sm4 Feb 14 '14 at 3:28
  • \$\begingroup\$ textureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 300, 300, TextureOptions.DEFAULT); \$\endgroup\$ – user42152 Feb 15 '14 at 21:53
1
\$\begingroup\$

You are using TextureOptions.DEFAULT. If you inspect the TextureOptions class, you will notice that:

public static final TextureOptions DEFAULT = NEAREST; 

Which means your textures are being resampled using nearest-neighbor interpolation. AndEngine will automatically scale your game to the phone's resolution. If you are not scaling in steps of 2 (e.g. your resolution of choice is 800x480 and your phone's resolution is 1280x768) it will create "bandings".

Try TextureOptions.BILINEAR or TextureOptions.BILINEAR_PREMULTIPLYALPHA.

You can also try whether the following option improves the banding:

engineOptions.getRenderOptions().setDithering(true);

\$\endgroup\$
  • \$\begingroup\$ I already tried both of them and it didnt change anything. i am using a camera size of 1600x960. and the ratio is not the same as my phone. but even changing it to half of it wont make the bandings disappear \$\endgroup\$ – user42152 Feb 24 '14 at 16:38
  • \$\begingroup\$ @user42152 I've added another option to improve the sprite quality to the answer. \$\endgroup\$ – sm4 Feb 28 '14 at 7:01
  • \$\begingroup\$ yeah thanks. changing the TextureOptions didnt change anything. I am using dithering now as i didnt seem to have any performance issues. \$\endgroup\$ – user42152 Mar 3 '14 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.