I am using Box2DLights in one of my project. I worked on this project for a couple of month now, and I just tried to port it on Android, to see how it looks.
While the light effect look very nice on the desktop version of the game, it looks really ugly on the Android version. The light gradient is not smooth at all, with a color banding effect. Here are screenshots of the desktop and android versions :
To use Box2DLights in my game, I use this code in my GameScreen :
RayHandler.useDiffuseLight(true);
rayHandler = new RayHandler(world);
rayHandler.resizeFBO(Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/5);
rayHandler.setBlur(true);
rayHandler.setAmbientLight(new Color(0.15f, 0.15f, 0.15f, 0.1f));
I also tried to play with different parameters, such as :
rayHandler.diffuseBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);
Or
rayHandler.shadowBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);
Or
Gdx.gl.glEnable(GL20.GL_DITHER);
I don't know it that helps, but here are other precisions :
- My tileset was made on Photoshop and recorded as a PNG file with the mode RGB, 8 bits/channel
- This effect was observed on my 2 Android devices that are :
- Tablet Transformer Prime TF701 with Android 4.2.1
- LG G Stylo with Android 5.0.2
Thanks for you help !