In some of my 3d assets, I noticed instead of PNG they use a JPG texture for diffuse map and one for alpha map due to much less file size. I noticed neither Gltf spec nor JME PBRLighting does not support separate alpha map and upon exporting from blender to Gltf it combines those to PNG which largely increases the file size.
As an example on a texture with res 1024x1024:
With separate diffuse/alpha maps (in JPG) the size is 238 KB
After converted to PNG it becomes 1.2 MB
This can largely affect the size of my assets. I decided to test with a few other formats (TGA, PSD, DDS with dxt1,3,5, WebP) and noticed that WebP gave the best result in my test with a file of size 165 KB and quality loss was negligible and after that, it was the DDS DXT1 with a file size of 524 KB.
The interesting thing is that WebP image quality is looking better than DDS even though its size is much less than DDS!!
I used Gimp for conversion.
As I am going to target Android devices as well, the nice thing I found with WebP is that unlike DDS it is already supported by Android (but one must use JME’s AndroidBufferImageLoader instead of AndroidNativeImageLoader).
I am also interested to hear your ideas about using this format instead of PNG and that how wide it is used in games and if you have any other suggestions.
AndroidBufferImageLoader uses android BitmapFactory to load textures but seems it is deprecated in JME, idk why!
By default JME uses AndroidNativeImageLoader that uses the stb_image library with JNI but unfortunately, it does not support WebP.
For desktop, JME uses Java ImageIO to load textures, and ImageIO supports WebP via a plugin. You just need to add pluging to your gradle dependencies and ImageIO will automatically pick that:
Edit:
For desktop you also need to add this as well