Correct vram compression settings for iOS export?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Acoped

Hi, I have a problem when exporting to iOS: my app works but textures won’t show up.

I had a similar problem when exporting to Android, but found out that I need to disable etc textures for Android within the ‘Vram Compression’ section in project settings. Now I can successfully export with textures for Windows Desktop and Android.

Is there a similar problem for iOS textures? I found this in this thread:

Now I can make iOS build with etc2 files (enable etc2 compression and disable pvrtc)

But this doesn’t work for me. I found that newer iOS devices should support etc 2, and for broader support pvrtc should work as well. I believe I have tried all combinations of possible vram compression formats though, and I can’t get anything to work.

Any ideas? Thanks.

:bust_in_silhouette: Reply From: Calinou

Which rendering backend are you using? This will determine which backends work, and restrictions on texture sizes. GLES3 mandates support for non-power-of-two textures, but GLES2 doesn’t. Therefore, if you’re using GLES2, make sure all your textures use power-of-two sizes, especially if they have mipmaps or repeat enabled.

Both iOS and Android support ETC2, but only when using the GLES3 renderer. When using the GLES2 renderer, the only VRAM compression algorithm supported on both Android and iOS is ETC1.

In Godot 3.x, PVRTC can be used on iOS, but it involves additional steps since Godot does not include a PVRTC compressor. (PVRTC is only supported on iOS, not on Android due to hardware limitations.)

Thank you, confirmed this works as described. I’m now building for Android and iOS using GLES3 with ETC2 textures, and they all show up.

One problem remains though, I want to support all major platforms (PC, MAC, Linux, Android and iOS), but for some nodes I am currently using the editor to set a Texture to the Material of a MeshInstance. To get the build to work on iOS I had to manually change the Texture’s LoadPath to a .etc2.stex instead of the .s3tc.stex as it was previously. Is there a way to set this dynamically, or manually for each platform, so it looks for the relevant texture for each of the exports?

Acoped | 2022-04-14 21:54

I solved it, after searching a bit it seems you can’t use the editor if you want to export for several platforms, you have to load the texture by code. So for now I’m doing something like this:

extends MeshInstance 

func _ready():
    var texture = load("res://textures/texture.png")
    material_override = SpatialMaterial.new()
    material_override.albedo_texture = texture

Acoped | 2022-04-14 23:37