Support KTX2 Texture Compression Format

334 views
Skip to first unread message

Lin Qin

unread,
Nov 23, 2021, 9:10:31 AM11/23/21
to Graphics-dev
Hello,

Currently, most HTMLImageElement formats (e.g. JPEG / WebP / AVIF) focus on getting smaller size to download faster.
But video games (including WebGL) prefer texture compression formats which take much less memory (https://docs.unity3d.com/2020.3/Documentation/Manual/class-TextureImporterOverride.html).

Previously, the limitations of texture compression formats may:
    1. gpu raster is required;
    2. different platforms support different texture compression formats;
    3. some old formats (e.g. ETC2) are not smaller enough;

Now
    1. gpu raster is enabled by default;
    2. Basis Universal compression technology introduced in KTX2 can cross platform;
    3. ETC1S / ASTC can get smaller size.

If HTMLImageElement supports texture compression formats, can reduce 75%~97% memory and some decoding time (or no decoding at all), then reduce power consumption.
The Khronos Group has published KTX-Software as open-source tools around dealing with KTX 2.0 compressed textures (https://github.com/KhronosGroup/KTX-Software).
I have tried integrated KTX-Software into chromium locally. It works well on Android.

So does it make sense to support KTX2 texture compression format?

Ken Russell

unread,
Dec 2, 2021, 9:11:43 PM12/2/21
to Lin Qin, Graphics-dev
This is a great question. The main challenge in this area is reaching cross-browser agreement to support these "supercompressed" image formats in the <img> tag and elsewhere.

Does anyone else on this list have recent experience, or successes, adding new image or video formats to the web platform?

Alternatively - it looks like image/ktx2 is already registered as a MIME type - https://github.com/KhronosGroup/KTX-Specification/issues/18 . So perhaps Chromium can start accepting it, and web applications can target it via the picture element and:
   <source type="image/ktx2" ...>

as one option? And then other browsers can add support if they desire?

-Ken


lexa.k...@gmail.com

unread,
Dec 3, 2021, 7:52:30 AM12/3/21
to Graphics-dev, Kenneth Russell, Graphics-dev, Lin Qin
KTX2 is a generic container format that may contain almost any GPU texture payload; two supercompression schemes are just a part of that large set. On top of that, it supports 1D and 3D textures, cubemaps, arrays, simple animation sequences, channel swizzle and UV orientation metadata. KTX2 files also include a DFD block that provides EOTF and color primaries.

Should browser vendors add image/ktx2 as a supported picture source type, they would have to define a reasonable subset of KTX2 for web usage.

Keep in mind, that KTX2 supercompression codecs target VRAM usage; their network transmission size may be bigger than traditional formats like JPEG or PNG.

Ken Russell

unread,
Dec 3, 2021, 5:34:03 PM12/3/21
to lexa.k...@gmail.com, Graphics-dev, Lin Qin
Good points Alexey.

What would you think about supporting only the supercompressed subset of KTX2 payloads?

Fredrik Hubinette

unread,
Dec 3, 2021, 5:38:05 PM12/3/21
to Ken Russell, lexa.k...@gmail.com, Graphics-dev, Lin Qin
Ohh, looks like it supports HDR! :)


--
To unsubscribe from this group and stop receiving emails from it, send an email to graphics-dev...@chromium.org.
Reply all
Reply to author
Forward
0 new messages