PDA

View Full Version : Opengl best texture compression format on desktop nowadays



elect
12-19-2014, 12:14 AM
I did not find any valid resource online that is updated and compare the texture compression formats for OpenGL for desktop. Everything is either outdated or for mobile.

Looking on my platform, I see many different formats:


GL_ARB_compressed_texture_pixel_storage
GL_ARB_texture_compression
GL_ARB_texture_compression_bptc
GL_ARB_texture_compression_rgtc
GL_EXT_texture_compression_dxt1
GL_EXT_texture_compression_latc
GL_EXT_texture_compression_rgtc
GL_EXT_texture_compression_s3tc
GL_NV_texture_compression_vtc

I have some other if I query directly for the GL_COMPRESSED_TEXTURE_FORMATS


public static final int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
public static final int GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;
public static final int GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;

public static final int GL_PALETTE4_RGB8_OES = 0x8B90 = 35728;
public static final int GL_PALETTE4_RGBA8_OES = 0x8B91;
public static final int GL_PALETTE4_R5_G6_B5_OES = 0x8B92;
public static final int GL_PALETTE4_RGBA4_OES = 0x8B93;
public static final int GL_PALETTE4_RGB5_A1_OES = 0x8B94;
public static final int GL_PALETTE8_RGB8_OES = 0x8B95;
public static final int GL_PALETTE8_RGBA8_OES = 0x8B96;
public static final int GL_PALETTE8_R5_G6_B5_OES = 0x8B97;
public static final int GL_PALETTE8_RGBA4_OES = 0x8B98;
public static final int GL_PALETTE8_RGB5_A1_OES = 0x8B99 = 35737;

public static final int GL_COMPRESSED_RGB8_ETC2 = 0x9274 = 37492;
public static final int GL_COMPRESSED_SRGB8_ETC2 = 0x9275;
public static final int GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;
public static final int GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;
public static final int GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
public static final int GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279 = 37497;
public static final int GL_COMPRESSED_R11_EAC = 0x9270 = 37488;
public static final int GL_COMPRESSED_SIGNED_R11_EAC = 0x9271;
public static final int GL_COMPRESSED_RG11_EAC = 0x9272;
public static final int GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273 = 37491;

Although here (http://stackoverflow.com/questions/12358863/opengl-compressed-textures-and-extensions) Nicol says to not rely on the glGet but on the extensions..

As far as I got, all of them are lossy, right?

Googling around S3TC/DXTx/BCx seems the one most documented online but it is also very old and also outperformed by the more modern formats.

A very nice website comparing them is this one (https://software.intel.com/en-us/articles/android-texture-compression-a-comparison-study-with-code-sample), but is for mobile and is also the only website I found that explains the different targets of DXT3 and DXT5. But it misses the EC2 (https://www.khronos.org/assets/uploads/developers/library/2012-siggraph-opengl-es-bof/Ericsson-ETC2-SIGGRAPH_Aug12.pdf), that seems to be mandatory on GLES3 and GL4.3.

Another interesting website is this one (http://www.gamasutra.com/blogs/AlexandruVoica/20130419/190833/Why_efficiency_is_key_in_texture_compression_stand ards_for_mobile_graphics.php).


PVRTC (http://blog.imgtec.com/powervr/pvrtc-the-most-efficient-texture-compression-standard-for-the-mobile-graphics-world)seems to be the best one in terms of performances, but unfortunately it runs only on dedicated hardware.
ASTC (http://malideveloper.arm.com/downloads/ASTC-GDC2013.pdf) is also very good promising but has the same disadvantage of PVRTC.
ATITC by name seems very old as well (ATI Texture Compression)


So, I wish to know which is nowadays the best compression formats for GL3+ on desktops in your opinion.

mbentrup
12-22-2014, 07:53 AM
On Desktop OpenGL you can basically only use the DXT variants or the BPTC format if you can assume DX10 or higher hardware. The ETC format is required by the OpenGL spec, but it is in fact not supported by current desktop Hardware. ETC textures are recompressed on load, so they are either slow, or have bad quality or both.

Note that many of the listed formats use the same compression algorithm, e.g. latc and rgtc are both dxt compressed two channel textures (so it is basically ATITC), but latc decodes the data as rgba=(x,x,x,y) and rgtc as rgba=(x,y,0,1).

ASTC seems to have the greatest flexibility, i.e. you can chose between quality and compression rate in a broad range, but desktop support is non-existant at the moment.

Alfonse Reinheart
12-22-2014, 09:41 AM
but latc decodes the data as rgba=(x,x,x,y) and rgtc as rgba=(x,y,0,1).

It should be noted that LATC is not core OpenGL. Also, through texture swizzling (https://www.opengl.org/wiki/Texture#Swizzle_mask), you can make RGTC work identically (which is why LATC is not core).

Dark Photon
12-24-2014, 10:56 AM
Note that many of the listed formats use the same compression algorithm, e.g. latc and rgtc are both dxt compressed two channel textures (so it is basically ATITC).
S3TC/DXT*/LATC/RGTC/3DC AFAIK are all derivations of the same base format, but this is the first time I've seen ATITC mentioned or said to be a copy/paste/tweak of this same base format.

Websearching a bit, ATITC doesn't seem to be a common or standard abbreviation for a texture compression format (I only see a few hits for Android TC and ATI TC). Could you clarify which texture compression format you're talking about and paste a link to the spec? Thanks!

Alfonse Reinheart
12-24-2014, 12:04 PM
I believe he's referring to ATi's short-lived 3Dc format (https://en.wikipedia.org/wiki/3Dc), which is (yet another) version of RGTC/BC5.

Dark Photon
12-24-2014, 05:55 PM
Ah! Ok, thanks.

To the original poster's question (compression on desktop), for universal support, I'd focus on the S3TC extension spec (DXT1 and DXT5 formats; ignore DXT3). There's lots of info and compressors out there that deals with these formats. Once you understand this spec and the underlying compression technique, RGTC and LATC (other extensions) are really trivial adaptations of S3TC. Beyond that, the ..._dxt1 extension spec is just a subset of S3TC for GL-ES to add DXT1 specifically. And VTC is NVidia's application of this same base compression method (DXT/S3TC) to 3D textures IIRC.

Past that, you're just left with the newer BPTC extension/formats. Requires newer GPUs, but offers higher quality LDR compression and HDR compression.

And to one of your other questions, all of them are lossy.

The line-up is different on embedded platforms, and not near as standard, leaving you with GPU-specific tex compression methods.

mbentrup
12-29-2014, 04:38 AM
As a side-note: the DXT1 and DXT5 formats are not part of OpenGL, as they are covered by patents. But they are implemented in hardware on all desktop GPUs. On the other hand the ETC/EAC format is part of OpenGL 4.3+, but there's no hardware support.