Is PNG suitable for textures?

Thanks for the detailed info - great to know. I won’t be able to use DDS textures exclusively on my project since all assets need to be downloadable on the fly and compatible with mobile GPUs, but I may look into storing both PNG and DDS textures serverside and allowing the client to choose the most suitable one.

1 Like

This answers pretty much every issue I’ve been having with height maps! Well now I know

1 Like

Knowing that AWT png loader does limit the color bits, why not switching it with an other PNG loader ? Is there other proper alternatives to current PNG loader?

I am asking because there might be other peoples who do not know about this limitation in PNG loader and they are using PNG textures and do not get the result they want after loading the model to JME.

1 Like

Funny you should mention it… I’ve been looking into that myself due to concerns about the compatibility of ImageIO with LWJGL3 (ImageIO is an AWT thing apparently, and as I’m sure you know AWT and LWJGL3 don’t play nicely together). All the discussions I’ve found indicate that ImageIO is OK to use with LWJGL3 as it doesn’t cause the problematic bits of AWT to load, so that concern is settled.

I’d like to hear someone with more experience comment on the 16-bit color downsampling for textures, but I would think it would not be a problem for RGBA textures (4 channels per pixel * 8 bits per channel = 32 bits per pixel, 24 bits of color = slightly more that 16 million colors - more than the human eye can detect). In other words, if I understand correctly the downsampling will only be an issue if you’re using 16 bits per channel - which wouldn’t make much sense for model textures.

2 Likes

what i have learned in the last years that there is always a usecase requireing a feature.
In general the downsampeling effect always gets noticable when you are in the mag filter range. The more stretched the texture the more visible is the stair effect.
Displacement maps produce a very noticable effect for example.

1 Like

HM in normalmaps it might be noticeable, In tesselation for terrain it definitly will be noticeable

Last time I did heightmaps I wrote a r16 loader because of exactly png’s not working as expected (at least I understand now why they did not work, yay :slight_smile: )

1 Like

I tried a lib once that can load 16 bits pngs. I had artifacts with PBR and I thought it was the issue… happens the issue was something else so I never pushed it…It was adding a dependency to a 3rd party lib that was more or less maintained by a single guy… not really trustworthy…

2 Likes

This might be a help ?
http://www.java-gaming.org/topics/lwjgl-stb-bindings/36153/view.html

STBDXT
A real-time DXT1/DXT5 compressor. If you need to compress textures at runtime, this should provide better quality than the compression done by OpenGL drivers.

1 Like
PNG 1/2/4/8-bit-per-channel (16 bpc not supported)

:frowning:

1 Like

It’s too bad the PNG loader doesn’t support 16 bit per channel files, but the runtime DXT compressor looks awesome! Thanks for posting @Ali_RS!

2 Likes

I’m strongly in favor for the DDS format.
It can store precomputed mipmaps, cubemaps and even 3d textures.
Another advantage: no build-in program in windows can read dds files, so if a user sneaks through the game resources and try to find out what assets they use (something I often do), it is harder to look at the images.

2 Likes

Hey Ali,

DDS explanation.

I went through this also. Now I am glad I did because I was forced to lean all the methods in Jme3 to tweak things to get the same results.

Are you going to export PNG from Blender and convert or have you found a script for Blender?

3 Likes

I do not know if we can do conversion in blender (going to look at it, it will be very cool if it is possible), I was considering to use imagemagick for conversion.

Edit:
@mitm thank for the link, from there I also found gimp-dds plug-in.

http://registry.gimp.org/node/70

Ubuntu users can install it directly from main repos
sudo apt-get install gimp-dds

2 Likes

thx :slight_smile:

2 Likes

Be careful. I found that DXT5nm is not supported by some Intel graphics cards, but still it is the best format to compress normal maps, especially when you use it with red and alpha channels swapped.
I solved it by rewriting JME’s material loader, creating both DXT5nm.dds and BC5.dds files for any important surface, and loading BC5 one instead of DXT5nm when game is running on Intel graphics card.

The best option to compress diffuse is DXT1.

Here is another useful link: http://vandaengine.org/an-overview-to-common-compressed-texture-formats/

2 Likes

Thank you. :slight_smile:

Yes compatibility with all gpus is important. I can use DXT1 for diffuse and height map and no I will not use DXT5nm, just regular DXT5 or DXT3 for normal map.

I will keep it in mind.

1 Like