godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91k stars 21.17k forks source link

Sprite appears as black rectangle on Android tablet #40808

Open KoBeWi opened 4 years ago

KoBeWi commented 4 years ago

Godot version:

3.2.2

OS/device including version:

Android on Lenovo Yoga Tab 3

Issue description:

I got a report that a Sprite appears as black rectangle on a particular Android device: image Of all sprites in the project, only this one is like this and it doesn't happen on other devices the game was tested on (although they were smart phones and the issue happened on tablet).

I can't test it myself, but I managed to extract the faulty scene (which hopefully is broken on its own too), so maybe someone can reproduce it too.

Steps to reproduce:

  1. Make APK from the reproduction project
  2. Run it on the device mentioned above

Minimal reproduction project:

androidblackrectangletestproject.zip

clayjohn commented 4 years ago

Is there anything unique about that particular sprite?

KoBeWi commented 4 years ago

There isn't anything unique about it. (or at least not something I know of)

lawnjelly commented 4 years ago

Your texture sizes are probably too big for mobile. Some of your textures are 4096 or 8192 in size. A good rule of thumb is to limit to 2048 as some devices are limited to this. If you really needed to you might be able to get away with 4096 on modern devices but personally I'd avoid it.

Adreno 304 max texture size is 4096: https://opengles.gpuinfo.org/displayreport.php?id=4554

Calinou commented 4 years ago

Here's the list of textures used in the MRP with their sizes:

❯ identify **/*.png                     
Levels/Level1/Sprites/arrow.png PNG 512x512 512x512+0+0 8-bit sRGB 9.54KB 0.000u 0:00.000
Levels/Level1/Sprites/Background/krzak15.png[1] PNG 176x1018 176x1018+0+0 8-bit RGB 37.1KB 0.000u 0:00.000
Levels/Level1/Sprites/dust.png[2] PNG 336x330 336x330+0+0 8-bit RGB 52.8KB 0.000u 0:00.000
Levels/Level2/Sprites/Background/chmura1.png[3] PNG 431x148 431x148+0+0 8-bit sRGB 11.8KB 0.000u 0:00.000
Levels/Level2/Sprites/Background/chmura2.png[4] PNG 229x54 229x54+0+0 8-bit sRGB 5.44KB 0.000u 0:00.000
Levels/Level2/Sprites/Background/chmura3.png[5] PNG 212x84 212x84+0+0 8-bit sRGB 4.76KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/chmura1.png[6] PNG 704x285 704x285+0+0 8-bit sRGB 12.2KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/chmura2.png[7] PNG 905x317 905x317+0+0 8-bit sRGB 24.3KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/chmura3.png[8] PNG 796x282 796x282+0+0 8-bit sRGB 19.4KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/kwaiteke.png[9] PNG 186x241 186x241+0+0 8-bit sRGB 12.8KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/kwiatek1.png[10] PNG 175x193 175x193+0+0 8-bit sRGB 27.6KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/kwiatek2.png[11] PNG 186x241 186x241+0+0 8-bit sRGB 29.3KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/kwiatek3.png[12] PNG 148x181 148x181+0+0 8-bit sRGB 9.73KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/motyl1.png[13] PNG 76x80 76x80+0+0 8-bit sRGB 3.47KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/motyl2.png[14] PNG 87x84 87x84+0+0 8-bit sRGB 3.79KB 0.000u 0:00.000
Levels/Level3/Sprites/Background/ptaszek.png[15] PNG 94x102 94x102+0+0 8-bit sRGB 3.28KB 0.000u 0:00.000
Levels/Level3/Sprites/Biedronka_animacja.png[16] PNG 4096x8192 4096x8192+0+0 8-bit sRGB 1.62MB 0.000u 0:00.000
Levels/Level4/Sprites/Background/drzewo.png[17] PNG 387x403 387x403+0+0 8-bit sRGB 18.3KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/grass1.png[18] PNG 269x296 269x296+0+0 8-bit sRGB 9.53KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/grass2.png[19] PNG 215x177 215x177+0+0 8-bit sRGB 6.17KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/grass3.png[20] PNG 273x225 273x225+0+0 8-bit sRGB 8.37KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/grass4.png[21] PNG 211x307 211x307+0+0 8-bit sRGB 7.41KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/grass5.png[22] PNG 109x196 109x196+0+0 8-bit sRGB 4.06KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/grass.png[23] PNG 237x285 237x285+0+0 8-bit sRGB 9.05KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/kamien.png[24] PNG 572x258 572x258+0+0 8-bit sRGB 15.4KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/ptaszek.png[25] PNG 110x86 110x86+0+0 8-bit sRGB 4.65KB 0.000u 0:00.000
Levels/Level4/Sprites/Background/pylek.png[26] PNG 61x46 61x46+0+0 8-bit sRGB 2.29KB 0.000u 0:00.000
Levels/Level4/Sprites/biedronka_pije.png[27] PNG 2048x4096 2048x4096+0+0 8-bit sRGB 1.542MB 0.000u 0:00.000
Levels/Level4/Sprites/Biedronka_test.png[28] PNG 4096x8192 4096x8192+0+0 8-bit sRGB 1.266MB 0.000u 0:00.000
Levels/Level4/Sprites/Dzban.png[29] PNG 155x178 155x178+0+0 8-bit sRGB 13KB 0.000u 0:00.000
Levels/Level4/Sprites/DzbanWoda.png[30] PNG 88x109 88x109+0+0 8-bit sRGB 2KB 0.000u 0:00.000
Levels/Level4/Sprites/niebieski_kwiat.png[31] PNG 512x512 512x512+0+0 8-bit sRGB 29.6KB 0.000u 0:00.000
Levels/Level4/Sprites/pszczola.png[32] PNG 1024x1024 1024x1024+0+0 8-bit sRGB 288KB 0.000u 0:00.000
Misc/UI/PasekOver.png[33] PNG 544x198 544x198+0+0 8-bit sRGB 22.3KB 0.010u 0:00.000
Misc/UI/PasekProgress.png[34] PNG 362x70 362x70+0+0 8-bit sRGB 3.11KB 0.000u 0:00.000
Misc/UI/PasekUnder.png[35] PNG 544x198 544x198+0+0 8-bit sRGB 2.35KB 0.000u 0:00.000

These ones are most likely the ones that fail to render on Android:

Levels/Level3/Sprites/Biedronka_animacja.png[16] PNG 4096x8192 4096x8192+0+0 8-bit sRGB 1.62MB 0.000u 0:00.000
Levels/Level4/Sprites/biedronka_pije.png[27] PNG 2048x4096 2048x4096+0+0 8-bit sRGB 1.542MB 0.000u 0:00.000
Levels/Level4/Sprites/Biedronka_test.png[28] PNG 4096x8192 4096x8192+0+0 8-bit sRGB 1.266MB 0.000u 0:00.000

This is probably already documented to an extent, but I guess we need to make it more obvious somehow. Any pointers?

lawnjelly commented 4 years ago

Maybe add a warning when exporting for android to the error log, at least if the texture is more than 4096? We should probably have warnings for large textures and possibly non-power of 2 textures (even a WARN_PRINT_ONCE for npot might be useful hint).

Or add a few bullet points to the Android export options, with common gotchas and referring to the docs.