I was wondering if anyone could explain this, i have a few stex files that are at least x10 larger than the original image file, why is this happening?
Stex filesize x10 larger than image file
- Edited
At a guess, no compression.
edit: The less compression the quicker to load into memory.
- Edited
what do you mean? I'm only interested in getting a smaller filesize. ofc, the jpg files are compressed and the import mode is lossless. altho changing it doesnt seem to affect the filesize.
@canvasbushi said: what do you mean?
I mean compression affects performance negatively, every texture has to be loaded into memory uncompressed, so compressed textures will have to go through a decompression step before they can be loaded into memory.
That is to say I was giving a reason for why it might be beneficial to have textures uncompressed.
I'm only interested in getting a smaller filesize. ofc, the jpg files are compressed and the import mode is lossless. altho changing it doesnt seem to affect the filesize.
Then try changing the textures compressions from lossless to something else, and reimporting before the export process?
the import mode is lossless. altho changing it doesnt seem to affect the filesize.
- Edited
Let me rephrase: did you actually reimport too, or just change the compression type selection without reimporting? The UI there is potentially a bit confusing. I'm guessing you did but worth asking anyways. Note that godot does not just magically auto reimport the assets.
i did. seems there is no way to compress asset filesize with godot, if it does decompress to create stex files. unless you have another idea.
Game Assets vs Import
Game Assets
Import
- Edited
Right, so the .stex file is streaming textures, those are for streaming the textures straight from disc to memory, hence they have to be uncomressed(or at least thats what I expect to be the case for streaming textures).
https://docs.godotengine.org/en/3.1/classes/class_streamtexture.html
What I'm not clear on though is if godot generates them automatically when the game is launched or not. If you clear your export folder and reexport the game without launching the game, are they still genreated or do they appear only after the game's been executed?
edit: oh, could it be that you are looking not at exported games folders but the projects folders? In which case the streaming textures are likely generated for the editors own use and not for the exported game...
stex files are created automatically on import, from what i understand the stex files are whats packaged for the game.
So the resulting pck file is basically all the imports and the exe file is the engine(merged into one for mobile).
Right, so the .stex file is streaming textures, those are for streaming the textures straight from disc to memory, hence they have to be uncomressed.
Shouldn't the compressed jpg have a stex file of the compressed file and the decompression happening on the client's device. This would be a case where a 10mb game in Godot is 20mb or more.
You could try following whats stated in the following linked reply on reddit: https://www.reddit.com/r/godot/comments/7urc0k/exporting_dynamically_loaded_resources/dtmqpgp?utm_source=share&utm_medium=web2x
So essentially start by using the Orphan Resources Explorer(Projects > Tools menu) to remove any unused resources, if there are any, then delete the .import
folder(note the dot in the folder name) and let godot reimport only the files used by the final game before you export.
But it does seem that the individual assets can't then be compressed, however I haven't yet looked into if perhaps the .pck file itself can have compression, since it is essentially an archive of sorts. Might be worth exploring.
- Edited
Ok, downloaded the export templates for 3.1, and(looking at linux export template) the exporter shows me options for selecting specific texture compression formats in the options tab, most are off by default, and in the Resources tab different export modes to select from, I reckon the easiest choice is to Export selected scenes(and dependencies)
.
I've already done that and the pck file can be compressed, however it would only save you a few mb max(maybe 1-10mb if lucky - gzip ultra). also its only possible to compress only for platforms where the pck file is accessible like html export.
Selecting "selected scenes(and dependencies)" on export would result in the same size, my project is optimized and i have no waste files.
Yes, looking at the android export template there are no obvious compression formats to choose from, but afaik most mobile devices only support one specific format anyways, so it might already be on by default perhaps.
I've also optimized the engine.
scons -j4 platform=android target=release android_arch=armv7 tools=no disable_3d=yes use_lto=yes optimize=size module_bmp_enabled=no module_bullet_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_gdnative_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_mbedtls_enabled=no module_mobile_vr_enabled=no module_opus_enabled=no module_pvr_enabled=no module_recast_enabled=no module_regex_enabled=no module_squish_enabled=no module_tga_enabled=no module_thekla_unwrap_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_websocket_enabled=no
scons -j4 platform=android target=release android_arch=arm64v8 tools=no disable_3d=yes use_lto=yes optimize=size module_bmp_enabled=no module_bullet_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_gdnative_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_mbedtls_enabled=no module_mobile_vr_enabled=no module_opus_enabled=no module_pvr_enabled=no module_recast_enabled=no module_regex_enabled=no module_squish_enabled=no module_tga_enabled=no module_thekla_unwrap_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_websocket_enabled=no
scons -j4 platform=android target=release android_arch=x86 tools=no disable_3d=yes use_lto=yes optimize=size module_bmp_enabled=no module_bullet_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_gdnative_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_mbedtls_enabled=no module_mobile_vr_enabled=no module_opus_enabled=no module_pvr_enabled=no module_recast_enabled=no module_regex_enabled=no module_squish_enabled=no module_tga_enabled=no module_thekla_unwrap_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_websocket_enabled=no
Might be worth adding your voice(so to speak) to the specific issue report: https://github.com/godotengine/godot/issues/29415
Sweet, guess i just didn't hit "Reimport" when i changed it to lossy mode, filesize went down to 200+ kb