Advertisement

how to get the best precision for RGBA16F which use PNG to store normal, depth, etc?

Started by July 19, 2024 05:04 AM
7 comments, last by gpu 5 months ago

how to get the best precision for RGBA16F which use PNG to store normal, depth, etc? Thanks! found there are precision problems on Android.

gpu said:
found there are precision problems on Android.

Probably the problems are not caused from the 16 bit restriction, but actually from compression / quantization applied to keep the files small.

Check export settings in your image editor to disable compression completely, to see if it makes a difference.

Consider to use a native GPU texture file format like DDS instead PNG, which usually gives much better controls over compression artifacts and makes a difference between normals or colors for example. (Idk which file format became standard for textures on mobiles.)

If all else fails, it can help to add noise to the images, e.g. to remove banding artifacts.

Advertisement

PNG doesn't support 16-bit float data, only 16-bit integer data. For floating point, you need to use a format such as EXR. The BC6 and ASTC texture compression formats also support floating point data, and are more suited for direct use by GPU. If you are on android, ASTC is probably what you want.

Do you really need 16-bit float? The only case I can think of this being needed is for HDR skyboxes. For most other cases 8-bit is sufficient for an end delivery format (e.g. albedo, normals, metalness, roughness, AO). Why do you even need to store depth in an image format, unless you are doing something like the pre-rendered fixed-camera Resident Evil games?

@undefined Thanks! but using the same texture it works ok and no artifact on PC in WebBrowser. donot know how many differences between this platform and Android, both using GLES; and which one of them casue the artifact on Android. might it be the different float IEEE standard?

Aressera said:
PNG doesn't support 16-bit float data, only 16-bit integer data.

Thanks! but it's strange why it works ok on PC in WebBrowser.

On Android, the original PNG was used to create Bitmap and its format is RGBA_F16 which comment as Deprecated. However, when the PNG open in Gimp shows that it's RGB16 UShort Linear.

gpu said:
using the same texture it works ok and no artifact on PC in WebBrowser.

You might want to show a screenshot, and tell if you do any processing of the image using shaders.
But personally i could not really help then either. My experience with mobile games is too outdated. Iirc, i have use PNG for textures too, because native compressed formats were not yet fully standardized and differed across chips back then.

However, we know that desktop GPUs use F32 for everything by default, but on mobiles it's mostly F16.
So it could be because of that.
But maybe there also is an issue with loading the PNG and converting it to the native GPU format. So using native image formats is still worth a try.

Advertisement

JoeJ said:
However, we know that desktop GPUs use F32 for everything by default, but on mobiles it's mostly F16.

Thanks! how do i search for this, the keyword? or would you please give me a specification link?

JoeJ said:
But maybe there also is an issue with loading the PNG and converting it to the native GPU format. So using native image formats is still worth a try.

what do you mean native format here, PNG and astc both have banding artifact.
i just checked, and the PNG i used was compressed by 15% now, and maybe that's the problem.

howerver, still curious that why it's ok on PC using WebGL. maybe because desktop GPUs use F32 for everything :D

Thanks so much for so detailed and quick reply.

This topic is closed to new replies.

Advertisement