Godot: Abnormal texture on Android

Created on 7 Mar 2019  路  18Comments  路  Source: godotengine/godot

Export Android. After changing scenes on the mobile phone, the texture loading is abnormal and the screen appears.
abnormal 1
abnormal 1
abnormal 2

On PC:
normal value

bug confirmed android rendering

Most helpful comment

It seems the problem is that, despite the specification saying OpenGL ES 3.0 supports fully non power of 2 textures including mipmaps, this is not true for ETC and ETC2. This is confusing and was not mentioned in the specification.

@316902108 You will need to re-import your textures (delete .import folder) after using a build with this fix.

All 18 comments

Godot version? Android device and OS version?

鎴堝鐗堬紵Android璁惧鍜屾搷浣滅郴缁熺増鏈紵

Godot3.0 and 3.1 Have tried
Android 9 (API 28)
Android SDK Build-tools 28
JDK and JRE 1.8.0_131
Several Android devices and operating systems have tried

Thank you for your help and reply.

Godot 3.1 is not released yet, so what exact development version did you try?

Are you using GLES2 or GLES3?

Can you share a project that reproduces the issue?

Godot 3.1 Beta1--10
GLES2 Flash screen, more serious problem
GLES3 Texture anomaly

I'll share the project with you later. Thank you for your help.

APK.zip
XY.zip

This is my project, and the released APK

**Thank you for your help. This problem has troubled me for a long time.

I hope it can be solved.**

Thanks!

I tried it on my Xiaomi Pocophone F1 with Android 9, and I can reproduce the bug.

  • GLES3: Same issue as in the first post, textures are messed up
    screenshot_2019-03-07-13-38-28-898_net gamemk

  • GLES2 (after enabling rendering/vram_compression/import_etc, otherwise it doesn't include the proper textures for GLES2): It works, though there are some transparency issues:
    screenshot_2019-03-07-13-33-52-450_net gamemk

With some changes to the project you might be able to make GLES2 work as expected, which should also give you better compatibility with older phones which do not support GLES3. But the GLES3 bug needs to be investigated and fixed nevertheless.

Thank you for your reply!

This BUG has been tried on many Android phones, and there are similar mistakes.

We are Chinese GODOT enthusiasts !
Thank you for your efforts.

The issue on GLES3 seems to be with using textures with sizes which are not powers of 2.
For example Material/UI/UI_Picture/UI_Creat.png is 1118x663 px, if I resize it to 1024x512 px (both powers of 2), it works fine (of course it breaks the UI scale).

GLES3 is supposed to handle textures with non power of 2 automatically, so it's weird that this bug happens.

I tried your advice (both powers of 2), and BUG still exists.

Although the problem has not been solved thoroughly, thank you very much for your reply and patience.

Here's how it looks like for me after resizing Material/UI/UI_Picture/UI_Creat.png to 1024x512 px:
screenshot_2019-03-07-14-25-33-888_net gamemk
I did it with GIMP which also converted the color profile that it considered non-standard, so that might be another factor. (But I did check before that converting the color profile without resizing the texture did not fix the bug.)

"Role_Sprite"This is Sprite Animation, How to deal with the texture errors in this animation?
This animation is normal in other scenes.

The problem is due to importing textures as Video RAM compressed. If I change the import setting for all PNG files to the "2D" preset (Lossless), then everything works fine.

The issue comes from the importer_defaults category defined in your project.godot file:

[importer_defaults]

texture={
"compress/bptc_ldr": 0,
"compress/hdr_mode": 0,
"compress/lossy_quality": 0.7,
"compress/mode": 2,
"compress/normal_map": 0,
"detect_3d": false,
"flags/anisotropic": false,
"flags/filter": true,
"flags/mipmaps": true,
"flags/repeat": 1,
"flags/srgb": 2,
"process/HDR_as_SRGB": false,
"process/fix_alpha_border": false,
"process/invert_color": false,
"process/premult_alpha": false,
"size_limit": 0,
"stream": false,
"svg/scale": 1.0
}

If you remove that, delete the .import/ folder and all *.import files, all textures will properly be re-imported as 2D textures, in lossless.

VRAM compression makes sense for 3D games, but not so much for 2D.

If you do want to use VRAM compression nevertheless, you'll have to disable mipmaps (which are the ones causing this bug), or resize all textures to powers of 2.

BTW, after setting all textures to "Lossless" compression (Texture > 2D preset), it also work flawlessly on GLES2.

It seems the problem is that, despite the specification saying OpenGL ES 3.0 supports fully non power of 2 textures including mipmaps, this is not true for ETC and ETC2. This is confusing and was not mentioned in the specification.

@316902108 You will need to re-import your textures (delete .import folder) after using a build with this fix.

Thank you very much.
Thank you very much.

I love GODOT.

I will configure the file"project.godot"
/[importer_defaults]
/"compress/mode"
Set to "0"
Perfect solution to all problems.

Thank you very much,
I'm sorry to have caused you trouble.

I'm sorry to have caused you trouble.

You did not cause any trouble, you helped us fix a bug in the engine :)

I hope you'll translate your game in English eventually, it looks very nice!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spooner picture Spooner  路  3Comments

nunodonato picture nunodonato  路  3Comments

EdwardAngeles picture EdwardAngeles  路  3Comments

testman42 picture testman42  路  3Comments

mefihl picture mefihl  路  3Comments