PNG or JPG or X for textures?

Should I use PNGs or JPGs for my textures when I create a 3d model? Is there any disadvantage to always use PNGs even if the texture has no transparency? Or are there other texture formates natively better supported by JME (also on Android)?

You shouldn’t us jpg for normal maps as the compression changes the values of the normals and makes them technically wrong which can cause a lot of small issues. A normal map isn’t an image anyway, its values encoded in an image.

yeah PNG is not only used for the transparency, it’s also a loss less format.

Ok and how about other formats? in http://www.codeproject.com/Articles/867768/Android-Texture-Compression-a-comparison-study-wit it looks like PNG in general is not the best format for textures :wink: is it possible to implement a custom texture loader whlich can load ETC2 and register it in the AssetManager? or would I have to change JME internals to be able to use other texture formats?

ETC2 is a compression algorithm, not a file format.
I think we support it with DDS file.@Momoko_Fan can confirm.

It really depends,

Jpg is smallest, but with most artifacts
PNG larger, but lossless
DDS is largest,but fastest to load on desktop, not lossless, is compressed on gpu(saves 1/8 vram fro non transparent maps 1/4 for transparent)

And DDS textures work on Android as well? Loading speed is more important to me than the total size of the texture

I suggest to just test it, it might.

Also wirth a try the ETC2 should be storagble in dds if im not completly wrong.

There’s so many formats and compression methods out there you can go crazy.

For best compatibility it is recommended to use PNG for images with alpha and JPG for images without. Compression artifacts in JPG can be reduced by increasing quality % and using YCbCr 4:4:4 subsampling instead of 4:2:0.

1 Like

I would go for DDS instead of JPG. Quality will be roughly similar, but DDS will end up being considerably faster to load/upload to gpu, can embed minmaps, use less GPU memory.
My suggestion would be to use DDS for diffuse/specular/etc maps (with or without alpha) and PNG for normal maps and other special purpose things (channel control, heightmaps etc).

If you generate your dds with nvcompress (from nvidia), there an option for normal “-normal”
see in one of my pipeline :

DON’T generate DDS with imagemagick : it’s broken

Just note that DXT compression (which is what’s typically found inside DDS files) is not supported by mobile GPUs. Meaning, you cannot use it for Android / iOS deployment.